Browse Source

Log the number of blocks used in Block.calcChainWeight()

This makes it easier to check that the new consensus code is being used, and that it is working correctly.
chain-weight-consensus
CalDescent 3 years ago
parent
commit
db77108054
  1. 3
      src/main/java/org/qortal/block/Block.java

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

@ -796,7 +796,9 @@ public class Block {
NumberFormat formatter = new DecimalFormat("0.###E0");
boolean isLogging = LOGGER.getLevel().isLessSpecificThan(Level.TRACE);
int blockCount = 0;
for (BlockSummaryData blockSummaryData : blockSummaries) {
blockCount++;
StringBuilder stringBuilder = isLogging ? new StringBuilder(512) : null;
if (isLogging)
@ -829,6 +831,7 @@ public class Block {
if (NTP.getTime() >= BlockChain.getInstance().getCalcChainWeightTimestamp() && parentHeight >= maxHeight)
break;
}
LOGGER.debug(String.format("Chain weight calculation was based on %d blocks", blockCount));
return cumulativeWeight;
}

Loading…
Cancel
Save