Adjust change calc (#2145)

This commit is contained in:
Jaco Greeff
2020-04-08 17:23:59 +02:00
committed by GitHub
parent d420cede82
commit a241bd1c38
+9 -1
View File
@@ -127,7 +127,15 @@ export function approxChanges (threshold: VoteThreshold, sqrtElectorate: BN, vot
inc.idivn(10);
}
return { changeAye, changeNay, isPassing };
return {
changeAye: isPassing
? BN.min(changeAye, votedAye)
: changeAye,
changeNay: isPassing
? changeNay
: BN.min(changeNay, votedNay),
isPassing
};
}
function calcVotesPrev (votesFor: DeriveReferendumVote[]): DeriveReferendumVoteState {