mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-23 06:35:17 +01:00
BitcoinNetworkParams: improve logging if max difficulty target has been hit
This commit is contained in:
parent
c60c612107
commit
318ead0a74
1 changed files with 6 additions and 3 deletions
|
@ -211,9 +211,12 @@ public abstract class BitcoinNetworkParams extends NetworkParameters {
|
|||
newTarget = newTarget.multiply(BigInteger.valueOf(timespan));
|
||||
newTarget = newTarget.divide(BigInteger.valueOf(targetTimespan));
|
||||
|
||||
if (newTarget.compareTo(this.getMaxTarget()) > 0) {
|
||||
log.info("Difficulty hit proof of work limit: {}", newTarget.toString(16));
|
||||
newTarget = this.getMaxTarget();
|
||||
BigInteger maxTarget = this.getMaxTarget();
|
||||
if (newTarget.compareTo(maxTarget) > 0) {
|
||||
log.info("Difficulty hit proof of work limit: {} vs {}",
|
||||
Long.toHexString(ByteUtils.encodeCompactBits(newTarget)),
|
||||
Long.toHexString(ByteUtils.encodeCompactBits(maxTarget)));
|
||||
newTarget = maxTarget;
|
||||
}
|
||||
|
||||
int accuracyBytes = (int) (nextBlock.getDifficultyTarget() >>> 24) - 3;
|
||||
|
|
Loading…
Add table
Reference in a new issue