Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Aug 8, 2024
1 parent 73edf0b commit 0d35385
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
1 change: 1 addition & 0 deletions process/testdata/executingSCCall.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"operation": "ESDTNFTTransfer",
"fee": "0",
"callType": "directCall",
"status": "pending",
"options": 0
}
]
Expand Down
2 changes: 1 addition & 1 deletion process/testdata/finishedOKRelayedTxIntraShard.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"receiver": "erd1kyaqzaprcdnv4luvanah0gfxzzsnpaygsy6pytrexll2urtd05ts9vegu7",
"sender": "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
"timestamp": 1707396974,
"status": "success",
"status": "pending",
"operation": "transfer",
"fee": "0",
"callType": "directCall",
Expand Down
2 changes: 1 addition & 1 deletion process/testdata/finishedOKRelayedTxWithSCCall.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"returnMessage": "gas refund for relayer",
"sourceShard": 2,
"destinationShard": 2,
"status": "success",
"status": "pending",
"operation": "transfer",
"fee": "0",
"isRefund": true,
Expand Down
8 changes: 1 addition & 7 deletions process/transactionProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,14 +512,8 @@ func (tp *TransactionProcessor) computeTransactionStatus(tx *transaction.ApiTran
}
}

if checkIfCompleted(allLogs) {
return &data.ProcessStatusResponse{
Status: string(transaction.TxStatusSuccess),
}
}

return &data.ProcessStatusResponse{
Status: string(transaction.TxStatusPending),
Status: string(transaction.TxStatusSuccess),
}
}

Expand Down
13 changes: 3 additions & 10 deletions process/transactionProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1959,15 +1959,6 @@ func TestTransactionProcessor_computeTransactionStatus(t *testing.T) {
status := tp.ComputeTransactionStatus(testData.Transaction, withResults)
require.Equal(t, string(transaction.TxStatusSuccess), status.Status)
})
t.Run("tx ok but with nil logs", func(t *testing.T) {
t.Parallel()

testData := loadJsonIntoTxAndScrs(t, "./testdata/finishedOKSCCall.json")
tp := createTestProcessorFromScenarioData(testData)
testData.Transaction.Logs = nil
status := tp.ComputeTransactionStatus(testData.Transaction, withResults)
require.Equal(t, string(transaction.TxStatusPending), status.Status)
})
t.Run("tx failed", func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -2073,6 +2064,7 @@ func TestTransactionProcessor_computeTransactionStatus(t *testing.T) {
t.Parallel()

testData := loadJsonIntoTxAndScrs(t, "./testdata/finishedOKRelayedTxIntraShard.json")
testData.SCRs[0].Status = transaction.TxStatusSuccess
tp := createTestProcessorFromScenarioData(testData)

status := tp.ComputeTransactionStatus(testData.Transaction, withResults)
Expand Down Expand Up @@ -2112,6 +2104,7 @@ func TestTransactionProcessor_computeTransactionStatus(t *testing.T) {
t.Parallel()

testData := loadJsonIntoTxAndScrs(t, "./testdata/finishedOKRelayedTxWithSCCall.json")
testData.SCRs[1].Status = transaction.TxStatusSuccess
tp := createTestProcessorFromScenarioData(testData)

status := tp.ComputeTransactionStatus(testData.Transaction, withResults)
Expand Down Expand Up @@ -2175,7 +2168,7 @@ func TestTransactionProcessor_GetProcessedTransactionStatus(t *testing.T) {

txResponse := value.(*data.GetTransactionResponse)
txResponse.Data.Transaction.Nonce = 0
txResponse.Data.Transaction.Status = transaction.TxStatusSuccess
txResponse.Data.Transaction.Status = transaction.TxStatusPending

return http.StatusOK, nil
},
Expand Down

0 comments on commit 0d35385

Please sign in to comment.