From be7d019ae93a6c044dfa4f3c87695c94d3e88b5c Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Sun, 17 Mar 2019 01:34:42 +0800 Subject: core: fix headerchain coinbase validation Coinbase address is the owner address of the node. --- core/headerchain.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'core') 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") -- cgit v1.2.3