diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-05 13:49:08 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:17 +0800 |
commit | f25aef2df9d8fee03569bdd47a923a24ed311299 (patch) | |
tree | 0f4327925c48dbff3e4f2cc3c202bbb7231e4208 /dex | |
parent | 0542a6a1b13c3c1235f68a2d0cca23976c241ca9 (diff) | |
download | go-tangerine-f25aef2df9d8fee03569bdd47a923a24ed311299.tar go-tangerine-f25aef2df9d8fee03569bdd47a923a24ed311299.tar.gz go-tangerine-f25aef2df9d8fee03569bdd47a923a24ed311299.tar.bz2 go-tangerine-f25aef2df9d8fee03569bdd47a923a24ed311299.tar.lz go-tangerine-f25aef2df9d8fee03569bdd47a923a24ed311299.tar.xz go-tangerine-f25aef2df9d8fee03569bdd47a923a24ed311299.tar.zst go-tangerine-f25aef2df9d8fee03569bdd47a923a24ed311299.zip |
core: validate roundHeight mapping in governance contract
Diffstat (limited to 'dex')
-rw-r--r-- | dex/governance.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/dex/governance.go b/dex/governance.go index 766920a62..d9a1fa467 100644 --- a/dex/governance.go +++ b/dex/governance.go @@ -24,6 +24,8 @@ import ( "github.com/dexon-foundation/dexon/rpc" ) +const configActivationOffset = 2 + type DexconGovernance struct { b *DexAPIBackend chainConfig *params.ChainConfig @@ -66,6 +68,11 @@ func (d *DexconGovernance) getGovState() *vm.GovernanceStateHelper { } func (d *DexconGovernance) getGovStateAtRound(round uint64) *vm.GovernanceStateHelper { + if round < configActivationOffset { + round = 0 + } else { + round -= configActivationOffset + } ctx := context.Background() blockHeight, err := d.getRoundHeight(ctx, round) if err != nil { |