aboutsummaryrefslogtreecommitdiffstats
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 13:50:04 +0800
commit6895f40ee771738227a6a0eefe1550ded7a5bd26 (patch)
tree9ef3739f66386227f22d8e7c30e9499604a1f23b
parent837963ca3233e7dcd20bdd1b9f67c5f2bec9763d (diff)
downloaddexon-6895f40ee771738227a6a0eefe1550ded7a5bd26.tar.gz
dexon-6895f40ee771738227a6a0eefe1550ded7a5bd26.tar.zst
dexon-6895f40ee771738227a6a0eefe1550ded7a5bd26.zip
core: fix headerchain coinbase validation
Coinbase address is the owner address of the node.
-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")