aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-19 20:52:46 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-13 18:11:44 +0800
commit2e9584d1d6690de6a4fa1ee6da6f988b2d746681 (patch)
treec0b7d8de41b616b2acb81e3c1d97967233d90072
parente88b78cb0c2d3736d31a79de46e99461e26f5161 (diff)
downloadgo-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.go19
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) {