diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-19 20:52:46 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-13 18:11:44 +0800 |
commit | 2e9584d1d6690de6a4fa1ee6da6f988b2d746681 (patch) | |
tree | c0b7d8de41b616b2acb81e3c1d97967233d90072 | |
parent | e88b78cb0c2d3736d31a79de46e99461e26f5161 (diff) | |
download | go-tangerine-2e9584d1d6690de6a4fa1ee6da6f988b2d746681.tar.gz go-tangerine-2e9584d1d6690de6a4fa1ee6da6f988b2d746681.tar.zst go-tangerine-2e9584d1d6690de6a4fa1ee6da6f988b2d746681.zip |
core: check coinbase for empty block (#282)
-rw-r--r-- | core/headerchain.go | 19 |
1 files changed, 13 insertions, 6 deletions
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) { |