From b823126bfe5625ea8e0a70c8803ebee7d07e28e6 Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Sat, 9 May 2020 10:43:08 -0700 Subject: [PATCH] verify block before proposal (#2968) * verify block before proposal * only verify header after block proposal --- node/node_newblock.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/node_newblock.go b/node/node_newblock.go index 0b8ba0b128..dcbce6a660 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -50,7 +50,11 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan struct{}, stopChan ch Msg("PROPOSING NEW BLOCK ------------------------------------------------") newBlock, err := node.proposeNewBlock() + if err != nil { + utils.Logger().Err(err).Msg("!!!!!!!!!Failed Proposing New Block!!!!!!!!!") + } + err = node.Blockchain().Validator().ValidateHeader(newBlock, true) if err == nil { utils.Logger().Debug(). Uint64("blockNum", newBlock.NumberU64()). @@ -65,7 +69,7 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan struct{}, stopChan ch node.BlockChannel <- newBlock break } else { - utils.Logger().Err(err).Msg("!!!!!!!!!Failed Proposing New Block!!!!!!!!!") + utils.Logger().Err(err).Msg("!!!!!!!!!Failed Verifying New Block Header!!!!!!!!!") } } }