diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-19 20:52:46 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-19 20:52:46 +0800 |
commit | d22b689fdfafc3535e1008dd4e3b05d81588f807 (patch) | |
tree | 8c83aa65cac2637ae9e96e5ec3fb292a0d126703 | |
parent | f817662c0e520e645f55518390836cb3594ffb38 (diff) | |
download | dexon-d22b689fdfafc3535e1008dd4e3b05d81588f807.tar.gz dexon-d22b689fdfafc3535e1008dd4e3b05d81588f807.tar.zst dexon-d22b689fdfafc3535e1008dd4e3b05d81588f807.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 adb7004b8..a51e78f66 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.Cmp(big.NewInt(coreBlock.Finalization.Timestamp.UnixNano()/1000000)) != 0 { |