Skip to content

Commit 314e91f

Browse files
committed
Compatible with preNonces shortening
1 parent f34f3ea commit 314e91f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

x/plugin/staking_plugin.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ func (sk *StakingPlugin) CreateCandidate(state xcom.StateDB, blockHash common.Ha
355355
return nil
356356
}
357357

358-
/// This method may only be called when creatStaking
358+
// / This method may only be called when creatStaking
359359
func (sk *StakingPlugin) RollBackStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int,
360360
addr common.NodeAddress, typ uint16) error {
361361

@@ -2949,9 +2949,10 @@ func vrfElection(validatorList staking.ValidatorQueue, shiftLen int, nonce []byt
29492949
return nil, err
29502950
}
29512951
if len(preNonces) < len(validatorList) {
2952-
log.Error("Failed to vrfElection on Election", "blockNumber", blockNumber, "validatorListSize", len(validatorList),
2953-
"nonceSize", len(nonce), "preNoncesSize", len(preNonces), "parentHash", hex.EncodeToString(parentHash.Bytes()))
2954-
return nil, staking.ErrWrongFuncParams
2952+
validatorList = validatorList[:len(preNonces)]
2953+
//log.Error("Failed to vrfElection on Election", "blockNumber", blockNumber, "validatorListSize", len(validatorList),
2954+
// "nonceSize", len(nonce), "preNoncesSize", len(preNonces), "parentHash", hex.EncodeToString(parentHash.Bytes()))
2955+
//return nil, staking.ErrWrongFuncParams
29552956
}
29562957
if len(preNonces) > len(validatorList) {
29572958
preNonces = preNonces[len(preNonces)-len(validatorList):]

0 commit comments

Comments
 (0)