diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-03-17 01:34:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-19 17:10:18 +0800 |
commit | b9a6ebcf74423c0a8b4e164a8bb543ce20b1ef47 (patch) | |
tree | dbd2b46b588fc7fbaf092a43e4458a99368361c9 | |
parent | 422fc9e2ba20835de3c65bcc720ccfb85c523914 (diff) | |
download | dexon-b9a6ebcf74423c0a8b4e164a8bb543ce20b1ef47.tar.gz dexon-b9a6ebcf74423c0a8b4e164a8bb543ce20b1ef47.tar.zst dexon-b9a6ebcf74423c0a8b4e164a8bb543ce20b1ef47.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 c1ad04e5d..adb7004b8 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") |