Fix incorrect vote weights in voting history JSON

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.
This commit is contained in:
Steven Barclay 2024-05-06 20:42:13 +02:00
parent 57662ae206
commit 74b5580b2c
No known key found for this signature in database
GPG key ID: 9FED6BF1176D500B

View file

@ -985,9 +985,9 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
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");