Skip to content

Commit

Permalink
Fix transaction output
Browse files Browse the repository at this point in the history
  • Loading branch information
peterlimg committed Feb 9, 2024
1 parent c713e1b commit 9d83189
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions zcncore/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 9d83189

Please sign in to comment.