From 614cca7f39b8d63a5da938e56509e6fa5fc467cf Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Tue, 19 Mar 2019 20:52:46 +0800 Subject: core: check coinbase for empty block (#282) --- core/headerchain.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'core') diff --git a/core/headerchain.go b/core/headerchain.go index 61822210c..0c2000064 100644 --- a/core/headerchain.go +++ b/core/headerchain.go @@ -519,13 +519,20 @@ func (hc *HeaderChain) verifyDexonHeader(header *types.Header, } gs := gov.GetStateForConfigAtRound(header.Round) - node, err := gs.GetNodeByID(coreBlock.ProposerID) - if err != nil { - return err - } - if header.Coinbase != node.Owner { - return fmt.Errorf("coinbase mismatch") + if coreBlock.IsEmpty() { + if header.Coinbase != (common.Address{}) { + return fmt.Errorf("coinbase should be nil for empty block") + } + } else { + node, err := gs.GetNodeByID(coreBlock.ProposerID) + if err != nil { + return err + } + + if header.Coinbase != node.Owner { + return fmt.Errorf("coinbase mismatch") + } } if header.Time != uint64(coreBlock.Finalization.Timestamp.UnixNano()/1000000) { -- cgit v1.2.3