aboutsummaryrefslogtreecommitdiffstats
path: root/core/headerchain.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-19 20:52:46 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:58 +0800
commit614cca7f39b8d63a5da938e56509e6fa5fc467cf (patch)
tree2631b23726ec79da01dfb9223336a4456b3fc101 /core/headerchain.go
parent341e066c7f75a819ba2ebe6bd05645889493a98e (diff)
downloaddexon-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/headerchain.go')
-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) {