diff --git a/consensus/istanbul/validator/weighted.go b/consensus/istanbul/validator/weighted.go index 51e914bce7..73f21395f0 100644 --- a/consensus/istanbul/validator/weighted.go +++ b/consensus/istanbul/validator/weighted.go @@ -665,8 +665,13 @@ func (valSet *weightedCouncil) Refresh(hash common.Hash, blockNum uint64, config return nil } - totalStaking, _ := calcTotalAmount(weightedValidators, newStakingInfo, stakingAmounts) - calcWeight(weightedValidators, stakingAmounts, totalStaking) + // weight and gini were neutralized after Kore hard fork + if chainRules.IsKore { + setZeroWeight(weightedValidators) + } else { + totalStaking, _ := calcTotalAmount(weightedValidators, newStakingInfo, stakingAmounts) + calcWeight(weightedValidators, stakingAmounts, totalStaking) + } valSet.refreshProposers(seed, blockNum) @@ -822,6 +827,13 @@ func calcTotalAmount(weightedValidators []*weightedValidator, stakingInfo *rewar return totalStaking, gini } +// setZeroWeight makes each validator's weight to zero +func setZeroWeight(weightedValidators []*weightedValidator) { + for _, weightedVal := range weightedValidators { + atomic.StoreUint64(&weightedVal.weight, 0) + } +} + // calcWeight updates each validator's weight based on the ratio of its staking amount vs. the total staking amount. func calcWeight(weightedValidators []*weightedValidator, stakingAmounts []float64, totalStaking float64) { localLogger := logger.NewWith()