3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-14 19:25:51 +00:00

Make AbstractBitcoinNetParams.isDifficultyTransitionPoint(int height) public.

This commit is contained in:
Andreas Schildbach 2016-07-18 13:39:39 +02:00
parent 67c3d4d0e2
commit 2e4d64876d
2 changed files with 5 additions and 5 deletions

View File

@ -54,11 +54,11 @@ public abstract class AbstractBitcoinNetParams extends NetworkParameters {
/**
* Checks if we are at a difficulty transition point.
* @param storedPrev The previous stored block
* @param height The height of the previous stored block
* @return If this is a difficulty transition point
*/
protected boolean isDifficultyTransitionPoint(StoredBlock storedPrev) {
return ((storedPrev.getHeight() + 1) % this.getInterval()) == 0;
public final boolean isDifficultyTransitionPoint(final int height) {
return ((height + 1) % this.getInterval()) == 0;
}
@Override
@ -67,7 +67,7 @@ public abstract class AbstractBitcoinNetParams extends NetworkParameters {
Block prev = storedPrev.getHeader();
// Is this supposed to be a difficulty transition point?
if (!isDifficultyTransitionPoint(storedPrev)) {
if (!isDifficultyTransitionPoint(storedPrev.getHeight())) {
// No ... so check the difficulty didn't actually change.
if (nextBlock.getDifficultyTarget() != prev.getDifficultyTarget())

View File

@ -89,7 +89,7 @@ public class TestNet3Params extends AbstractBitcoinNetParams {
@Override
public void checkDifficultyTransitions(final StoredBlock storedPrev, final Block nextBlock,
final BlockStore blockStore) throws VerificationException, BlockStoreException {
if (!isDifficultyTransitionPoint(storedPrev) && nextBlock.getTime().after(testnetDiffDate)) {
if (!isDifficultyTransitionPoint(storedPrev.getHeight()) && nextBlock.getTime().after(testnetDiffDate)) {
Block prev = storedPrev.getHeader();
// After 15th February 2012 the rules on the testnet change to avoid people running up the difficulty