From 9d83189b57ddb426cd9e237d29a449aeae4126bd Mon Sep 17 00:00:00 2001 From: peterlimg Date: Fri, 9 Feb 2024 17:07:01 +0800 Subject: [PATCH] Fix transaction output --- zcncore/transaction.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/zcncore/transaction.go b/zcncore/transaction.go index 703b8dac4..ad1efee43 100644 --- a/zcncore/transaction.go +++ b/zcncore/transaction.go @@ -1039,18 +1039,18 @@ func (t *Transaction) Verify() error { } txnJson := conf["txn"] - var tr map[string]json.RawMessage - if err := json.Unmarshal(txnJson, &tr); err != nil { + tt := transaction.Transaction{} + if err := json.Unmarshal(txnJson, &tt); err != nil { return } - txStatus := tr["transaction_status"] - switch string(txStatus) { - case "1": - t.completeVerifyWithConStatus(StatusSuccess, int(Success), string(output), nil) - case "2": - txOutput := tr["transaction_output"] - t.completeVerifyWithConStatus(StatusSuccess, int(ChargeableError), string(txOutput), nil) + *t.txn = tt + txStatus := tt.Status + switch txStatus { + case 1: + t.completeVerifyWithConStatus(StatusSuccess, int(Success), tt.TransactionOutput, nil) + case 2: + t.completeVerifyWithConStatus(StatusSuccess, int(ChargeableError), tt.TransactionOutput, nil) default: t.completeVerify(StatusError, string(output), nil) }