Skip to content

Commit 8e97ed7

Browse files
committed
block handler length verification
1 parent d64a066 commit 8e97ed7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

node/block_handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ func (n *Node) handleBeginBlock(ctx types.Context, blockID []byte, protoBlock *p
2727

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

0 commit comments

Comments
 (0)