From bfac0fd1c812592667b30184745becceb5ce1363 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Tue, 19 Feb 2019 14:33:22 +0800 Subject: core/vm: fix getConfigState (#203) --- core/vm/oracle_contracts.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go index b1a56606b..e060312e5 100644 --- a/core/vm/oracle_contracts.go +++ b/core/vm/oracle_contracts.go @@ -1158,17 +1158,16 @@ func (s *GovernanceStateHelper) emitDKGReset(round *big.Int, blockHeight *big.In func getConfigState(evm *EVM, round *big.Int) (*GovernanceStateHelper, error) { configRound := big.NewInt(0) - if round.Uint64() >= core.ConfigRoundShift { - configRound = new(big.Int).Sub(round, big.NewInt(int64(core.ConfigRoundShift-1))) + if round.Uint64() > core.ConfigRoundShift { + configRound = new(big.Int).Sub(round, big.NewInt(int64(core.ConfigRoundShift))) } gs := &GovernanceStateHelper{evm.StateDB} height := gs.RoundHeight(configRound).Uint64() - if round.Uint64() >= core.ConfigRoundShift { + if round.Uint64() > core.ConfigRoundShift { if height == 0 { return nil, errExecutionReverted } - height-- } statedb, err := evm.StateAtNumber(height) return &GovernanceStateHelper{statedb}, err -- cgit v1.2.3