From 2e5dac190cd3af744b72173bf1942b7619c85680 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 9 Feb 2024 22:56:24 +1000 Subject: [PATCH] revert the fix --- gossip/c_block_callbacks.go | 19 +++++++++++-------- gossip/txposition_test.go | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gossip/c_block_callbacks.go b/gossip/c_block_callbacks.go index cf026f043..d4fe3fea2 100644 --- a/gossip/c_block_callbacks.go +++ b/gossip/c_block_callbacks.go @@ -319,6 +319,7 @@ func consensusCallbackBeginBlockFn( for _, e := range blockEvents { txs = append(txs, e.Txs()...) } + _ = evmProcessor.Execute(txs) evmBlock, skippedTxs, allReceipts := evmProcessor.Finalize() @@ -343,16 +344,18 @@ func consensusCallbackBeginBlockFn( } } } + // memorize block position of each tx + for i, tx := range evmBlock.Transactions { + // not skipped txs only + position := txPositions[tx.Hash()] + position.Block = blockCtx.Idx + position.BlockOffset = uint32(i) + txPositions[tx.Hash()] = position + } + // call OnNewReceipt for i, r := range allReceipts { - // memorize block position for not skipped txs only - position := txPositions[r.TxHash] - position.Block = blockCtx.Idx - position.BlockOffset = uint32(r.TransactionIndex) - txPositions[r.TxHash] = position - // call OnNewReceipt - creator := position.EventCreator - // TODO: is it check necessary? + creator := txPositions[r.TxHash].EventCreator if creator != 0 && es.Validators.Get(creator) == 0 { creator = 0 } diff --git a/gossip/txposition_test.go b/gossip/txposition_test.go index 8651d2ae3..683e36d76 100644 --- a/gossip/txposition_test.go +++ b/gossip/txposition_test.go @@ -95,7 +95,7 @@ func TestTxIndexing(t *testing.T) { t.Fatal("skipped tx's receipt found") case tx4ok.Hash(): require.Equal(types.ReceiptStatusSuccessful, r.Status, i) - require.Equal(txPos.BlockOffset, uint32(3)) // THAT shows the effect of the fix #524 + require.Equal(txPos.BlockOffset, uint32(2)) // skipped txs aren't counted } for j, l := range r.Logs {