Don't assume the block has >=1 tx

Because we now allow empty blocks.
pull/839/head
Eugene Kim 6 years ago
parent 497bba1f77
commit e783c49d55
  1. 4
      node/node_handler.go

@ -256,9 +256,9 @@ func (node *Node) VerifyNewBlock(newBlock *types.Block) error {
// e.g. "child.Number == child.IsGenesis() ? 0 : parent.Number+1"?
err := node.Blockchain().ValidateNewBlock(newBlock, pki.GetAddressFromPublicKey(node.SelfPeer.ConsensusPubKey))
if err != nil {
return ctxerror.New("failed to ValidateNewBlock",
return ctxerror.New("cannot ValidateNewBlock",
"blockHash", newBlock.Hash(),
"tx", newBlock.Transactions()[0],
"numTx", len(newBlock.Transactions()),
).WithCause(err)
}

Loading…
Cancel
Save