Skip to content

Commit

Permalink
fix: ensure validator incoming will be clear after distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Dec 15, 2023
1 parent a913595 commit 8f78da0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/BSCValidatorSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica
for (uint i; i < currentValidatorSet.length; ++i) {
if (currentValidatorSet[i].incoming != 0) {
IStakeHub(STAKE_HUB_ADDR).distributeReward{value : currentValidatorSet[i].incoming}(currentValidatorSet[i].consensusAddress);
currentValidatorSet[i].incoming = 0;
}
}

Expand Down Expand Up @@ -478,6 +479,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica
isMigrated[directSize] = 0;
++directSize;
}
currentValidatorSet[i].incoming = 0;
}

//step 2: do cross chain transfer
Expand Down Expand Up @@ -918,11 +920,10 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica
validatorExtraSet[i].isMaintaining = false;
validatorExtraSet[i].enterMaintenanceHeight = 0;
} else {
// if the validator is the same, update the vote address if it is different
// update the vote address if it is different
if (!BytesLib.equal(newVoteAddrs[i], validatorExtraSet[i].voteAddress)) {
validatorExtraSet[i].voteAddress = newVoteAddrs[i];
}
currentValidatorSet[i].incoming = 0;
currentValidatorSet[i].jailed = newValidatorSet[i].jailed;
}
}
Expand Down

0 comments on commit 8f78da0

Please sign in to comment.