diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-03-17 01:34:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-13 18:11:44 +0800 |
commit | b4d5ec900749ccd421dd49dad0e679e771913b1b (patch) | |
tree | 1fe3ce20e92a84cfb6abff6f579960d54595f6e9 | |
parent | 560d599bd4e8febcf9a1ab11cce9dfe9b4c5bc52 (diff) | |
download | go-tangerine-b4d5ec900749ccd421dd49dad0e679e771913b1b.tar.gz go-tangerine-b4d5ec900749ccd421dd49dad0e679e771913b1b.tar.zst go-tangerine-b4d5ec900749ccd421dd49dad0e679e771913b1b.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") |