diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-03-17 01:34:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:58 +0800 |
commit | be7d019ae93a6c044dfa4f3c87695c94d3e88b5c (patch) | |
tree | 206568c9e3ddf3bfca80600c9b4762031282e49a | |
parent | eeec5d638dd675827ba9eebedf56ce9860522f55 (diff) | |
download | go-tangerine-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar go-tangerine-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.gz go-tangerine-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.bz2 go-tangerine-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.lz go-tangerine-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.xz go-tangerine-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.tar.zst go-tangerine-be7d019ae93a6c044dfa4f3c87695c94d3e88b5c.zip |
core: fix headerchain coinbase validation
Coinbase address is the owner address of the node.
-rw-r--r-- | core/headerchain.go | 9 |
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") |