Skip to content

Commit

Permalink
Fix incorrect vote weights in voting history JSON
Browse files Browse the repository at this point in the history
Make sure to include the BSQ stake, and not just the merit stake, when
summing to get the 'voteWeight' field of the vote on each evaluated
proposal in the exported vote results history JSON.
  • Loading branch information
stejbac committed May 6, 2024
1 parent 57662ae commit 74b5580
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,9 @@ private JsonElement getVotingHistoryJson() {
voteJson.addProperty("hashOfBlindVoteList", Utilities.bytesAsHexString(decryptedBallotsWithMerits.getHashOfBlindVoteList()));
voteJson.addProperty("blindVoteTxId", decryptedBallotsWithMerits.getBlindVoteTxId());
voteJson.addProperty("voteRevealTxId", decryptedBallotsWithMerits.getVoteRevealTxId());
voteJson.addProperty("stake", decryptedBallotsWithMerits.getStake());

voteJson.addProperty("voteWeight", meritStakeMap.get(decryptedBallotsWithMerits.getBlindVoteTxId()));
long stake = decryptedBallotsWithMerits.getStake();
voteJson.addProperty("stake", stake);
voteJson.addProperty("voteWeight", stake + meritStakeMap.get(decryptedBallotsWithMerits.getBlindVoteTxId()));
String voteResult = decryptedBallotsWithMerits.getVote(evaluatedProp.getProposalTxId())
.map(vote -> vote.isAccepted() ? "Accepted" : "Rejected")
.orElse("Ignored");
Expand Down

0 comments on commit 74b5580

Please sign in to comment.