Fixed vote weight results API call

blocksMintedPenalty is a negative value, so it should be added to blocksMinted, not subtracted.
This commit is contained in:
QuickMythril 2024-01-31 21:13:19 -05:00 committed by GitHub
parent 070f14b3dd
commit f78764880c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -142,7 +142,7 @@ public class PollsResource {
for (VoteOnPollData vote : votes) {
String voter = Crypto.toAddress(vote.getVoterPublicKey());
AccountData voterData = repository.getAccountRepository().getAccount(voter);
int voteWeight = voterData.getBlocksMinted() - voterData.getBlocksMintedPenalty();
int voteWeight = voterData.getBlocksMinted() + voterData.getBlocksMintedPenalty();
if (voteWeight < 0) voteWeight = 0;
totalWeight += voteWeight;