Commit 5376fc80 authored by EvanJRichard's avatar EvanJRichard

return check for nil tx in rpc block verification

parent 78eeb2a7
......@@ -196,6 +196,11 @@ func (block *rpcBlock) verify() error {
if computed := block.computeBlockHash(); computed != block.Hash {
return fmt.Errorf("failed to verify block hash: computed %s but RPC said %s", computed, block.Hash)
}
for i, tx := range block.Transactions {
if tx == nil {
return fmt.Errorf("block tx %d is nil", i)
}
}
if computed := types.DeriveSha(types.Transactions(block.Transactions), trie.NewStackTrie(nil)); block.TxHash != computed {
return fmt.Errorf("failed to verify transactions list: computed %s but RPC said %s", computed, block.TxHash)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment