Skip to content

Commit b63017c

Browse files
committed
votesum should > 0
1 parent 0e64cd4 commit b63017c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/main/java/org/tron/core/witness/WitnessController.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public void updateWitness() {
315315
.get(StringUtil.createDbKey(address));
316316
if (null == witnessCapsule) {
317317
logger.warn("witnessCapsule is null.address is {}",
318-
StringUtil.createReadableString(address));
318+
StringUtil.createReadableString(address));
319319
return;
320320
}
321321

@@ -376,12 +376,13 @@ private void payStandbyWitness(List<ByteString> list) {
376376
for (ByteString b : list) {
377377
voteSum += getWitnesseByAddress(b).getVoteCount();
378378
}
379-
for (ByteString b : list) {
380-
long pay = getWitnesseByAddress(b).getVoteCount() * totalPay / voteSum;
381-
AccountCapsule accountCapsule = manager.getAccountStore().get(b.toByteArray());
382-
accountCapsule.setAllowance(accountCapsule.getAllowance() + pay);
383-
manager.getAccountStore().put(accountCapsule.createDbKey(), accountCapsule);
379+
if (voteSum > 0) {
380+
for (ByteString b : list) {
381+
long pay = getWitnesseByAddress(b).getVoteCount() * totalPay / voteSum;
382+
AccountCapsule accountCapsule = manager.getAccountStore().get(b.toByteArray());
383+
accountCapsule.setAllowance(accountCapsule.getAllowance() + pay);
384+
manager.getAccountStore().put(accountCapsule.createDbKey(), accountCapsule);
385+
}
384386
}
385387
}
386-
387388
}

0 commit comments

Comments
 (0)