aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-17 01:34:42 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:58 +0800
commitbe7d019ae93a6c044dfa4f3c87695c94d3e88b5c (patch)
tree206568c9e3ddf3bfca80600c9b4762031282e49a /core
parenteeec5d638dd675827ba9eebedf56ce9860522f55 (diff)
downloaddexon-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar
dexon-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.gz
dexon-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.bz2
dexon-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.lz
dexon-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.xz
dexon-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.zst
dexon-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.zip
core: fix headerchain coinbase validation
Coinbase address is the owner address of the node.
Diffstat (limited to 'core')
-rw-r--r--core/headerchain.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/headerchain.go b/core/headerchain.go
index 946b96f18..61822210c 100644
--- a/core/headerchain.go
+++ b/core/headerchain.go
@@ -518,7 +518,13 @@ func (hc *HeaderChain) verifyDexonHeader(header *types.Header,
header.Number.Uint64(), err)
}
- if header.Coinbase != common.BytesToAddress(coreBlock.ProposerID.Bytes()) {
+ 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")
}
@@ -538,7 +544,6 @@ func (hc *HeaderChain) verifyDexonHeader(header *types.Header,
return fmt.Errorf("round mismatch")
}
- gs := gov.GetStateForConfigAtRound(header.Round)
config := gs.Configuration()
if header.GasLimit != config.BlockGasLimit {
return fmt.Errorf("block gas limit mismatch")