From 7553536dcb4c0b7bce0765ff3ab68193858ae5b3 Mon Sep 17 00:00:00 2001 From: Iuga Mihai Date: Tue, 7 Mar 2023 11:43:41 +0200 Subject: [PATCH] small fix --- node/external/transactionAPI/gasUsedAndFeeProcessor.go | 3 +++ node/external/transactionAPI/gasUsedAndFeeProcessor_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/node/external/transactionAPI/gasUsedAndFeeProcessor.go b/node/external/transactionAPI/gasUsedAndFeeProcessor.go index 42290a7db19..ad01d11726c 100644 --- a/node/external/transactionAPI/gasUsedAndFeeProcessor.go +++ b/node/external/transactionAPI/gasUsedAndFeeProcessor.go @@ -36,6 +36,9 @@ func (gfp *gasUsedAndFeeProcessor) computeAndAttachGasUsedAndFee(tx *transaction if !scr.IsRefund { continue } + if scr.RcvAddr != tx.Sender { + continue + } gfp.setGasUsedAndFeeBaseOnRefundValue(tx, scr.Value) hasRefund = true diff --git a/node/external/transactionAPI/gasUsedAndFeeProcessor_test.go b/node/external/transactionAPI/gasUsedAndFeeProcessor_test.go index 69bfd993dc9..2c351fd8be0 100644 --- a/node/external/transactionAPI/gasUsedAndFeeProcessor_test.go +++ b/node/external/transactionAPI/gasUsedAndFeeProcessor_test.go @@ -145,11 +145,14 @@ func TestComputeTransactionGasUsedAndFeeTransactionWithScrWithRefund(t *testing. RcvAddr: silentDecodeAddress(receiver), Data: []byte("relayedTx@"), }, + Sender: sender, + Receiver: receiver, GasLimit: 10_000_000, SmartContractResults: []*transaction.ApiSmartContractResult{ { Value: big.NewInt(66350000000000), IsRefund: true, + RcvAddr: sender, }, }, Logs: &transaction.ApiLogs{