Browse Source

Fixed divide by zero exception.

Block.calcKeyDistance() cannot be called on some trimmed blocks, because the minter level is unable to be inferred in some cases. This generally hasn't been an issue, but the new Block.logDebugInfo() method is invoking it for all blocks. For now I am adding defensiveness to the debug method, but longer term we might want to add defensiveness to Block.calcKeyDistance() itself, if we ever encounter this issue again. I will leave it alone for now, to reduce risk.
sync-multiple-blocks
CalDescent 3 years ago
parent
commit
d2ea5633fb
  1. 2
      src/main/java/org/qortal/block/Block.java

2
src/main/java/org/qortal/block/Block.java

@ -2021,7 +2021,7 @@ public class Block {
LOGGER.debug(String.format("Online accounts: %d", this.getBlockData().getOnlineAccountsCount())); LOGGER.debug(String.format("Online accounts: %d", this.getBlockData().getOnlineAccountsCount()));
BlockSummaryData blockSummaryData = new BlockSummaryData(this.getBlockData()); BlockSummaryData blockSummaryData = new BlockSummaryData(this.getBlockData());
if (this.getParent() == null || this.getParent().getSignature() == null || blockSummaryData == null) if (this.getParent() == null || this.getParent().getSignature() == null || blockSummaryData == null || minterLevel == 0)
return; return;
blockSummaryData.setMinterLevel(minterLevel); blockSummaryData.setMinterLevel(minterLevel);

Loading…
Cancel
Save