Skip to content

Commit

Permalink
revert the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rus-alex committed Feb 12, 2024
1 parent 9b6f168 commit 2e5dac1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions gossip/c_block_callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func consensusCallbackBeginBlockFn(
for _, e := range blockEvents {
txs = append(txs, e.Txs()...)
}

_ = evmProcessor.Execute(txs)

evmBlock, skippedTxs, allReceipts := evmProcessor.Finalize()
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion gossip/txposition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2e5dac1

Please sign in to comment.