Skip to content

Commit

Permalink
optimization: union the same loops
Browse files Browse the repository at this point in the history
  • Loading branch information
rus-alex committed Oct 29, 2023
1 parent ca803a4 commit 2ddbac4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions gossip/c_block_callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,18 +343,16 @@ func consensusCallbackBeginBlockFn(
}
}
}
// memorize block position of each tx
for _, r := range allReceipts {
// not skipped txs only

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
for i, r := range allReceipts {
creator := txPositions[r.TxHash].EventCreator
// call OnNewReceipt
creator := position.EventCreator
// TODO: is it check necessary?
if creator != 0 && es.Validators.Get(creator) == 0 {
creator = 0
}
Expand Down

0 comments on commit 2ddbac4

Please sign in to comment.