mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 02:35:52 +00:00
AbstractBitcoinNetParams.checkDifficultyTransitions: Check we're really on a transition point after finding the way back to the last one.
This commit is contained in:
parent
eccf14adeb
commit
c6418dc06d
@ -17,6 +17,8 @@
|
||||
|
||||
package org.bitcoinj.params;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -104,6 +106,8 @@ public abstract class AbstractBitcoinNetParams extends NetworkParameters {
|
||||
}
|
||||
hash = cursor.getHeader().getPrevBlockHash();
|
||||
}
|
||||
checkState(cursor != null && isDifficultyTransitionPoint(cursor.getHeight() - 1),
|
||||
"Didn't arrive at a transition point.");
|
||||
watch.stop();
|
||||
if (watch.elapsed(TimeUnit.MILLISECONDS) > 50)
|
||||
log.info("Difficulty transition traversal took {}", watch);
|
||||
|
Loading…
x
Reference in New Issue
Block a user