Skip to content

Commit

Permalink
block handler length verification
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cha committed Dec 10, 2024
1 parent d64a066 commit 8e97ed7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions node/block_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func (n *Node) handleBeginBlock(ctx types.Context, blockID []byte, protoBlock *p

// handleBlockTxs handles the block transactions.
func (n *Node) handleBlockTxs(ctx types.Context, block *rpccoretypes.ResultBlock, blockResult *rpccoretypes.ResultBlockResults, latestHeight int64) error {
if len(block.Block.Txs) != len(blockResult.TxsResults) {
return fmt.Errorf("mismatch in transactions and results count: %d vs %d", len(block.Block.Txs), len(blockResult.TxsResults))
}
for txIndex, tx := range block.Block.Txs {
if n.txHandler != nil {
err := n.txHandler(ctx, nodetypes.TxHandlerArgs{
Expand Down

0 comments on commit 8e97ed7

Please sign in to comment.