diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-19 20:52:46 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:58 +0800 |
commit | 614cca7f39b8d63a5da938e56509e6fa5fc467cf (patch) | |
tree | 2631b23726ec79da01dfb9223336a4456b3fc101 /core | |
parent | 341e066c7f75a819ba2ebe6bd05645889493a98e (diff) | |
download | dexon-614cca7f39b8d63a5da938e56509e6fa5fc467cf.tar dexon-614cca7f39b8d63a5da938e56509e6fa5fc467cf.tar.gz dexon-614cca7f39b8d63a5da938e56509e6fa5fc467cf.tar.bz2 dexon-614cca7f39b8d63a5da938e56509e6fa5fc467cf.tar.lz dexon-614cca7f39b8d63a5da938e56509e6fa5fc467cf.tar.xz dexon-614cca7f39b8d63a5da938e56509e6fa5fc467cf.tar.zst dexon-614cca7f39b8d63a5da938e56509e6fa5fc467cf.zip |
core: check coinbase for empty block (#282)
Diffstat (limited to 'core')
-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) { |