mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-30 23:02:15 +00:00
Added check of parsed difficulty bits.
Corrected difficult retarget interval.
This commit is contained in:
parent
0fe4ac43ba
commit
805b78f060
@ -173,8 +173,8 @@ public abstract class AbstractDogecoinParams extends NetworkParameters implement
|
||||
final int previousHeight = storedPrev.getHeight();
|
||||
final boolean digishieldAlgorithm = previousHeight + 1 >= this.getDigishieldBlockHeight();
|
||||
final int retargetInterval = digishieldAlgorithm
|
||||
? this.getInterval()
|
||||
: this.getNewInterval();
|
||||
? this.getNewInterval()
|
||||
: this.getInterval();
|
||||
|
||||
// Is this supposed to be a difficulty transition point?
|
||||
if ((storedPrev.getHeight() + 1) % retargetInterval != 0) {
|
||||
@ -226,7 +226,7 @@ public abstract class AbstractDogecoinParams extends NetworkParameters implement
|
||||
* @param lastRetargetTime Time of the last difficulty retarget.
|
||||
* @return New difficulty target as compact bytes.
|
||||
*/
|
||||
protected long getNewDifficultyTarget(int previousHeight, long previousBlockTime,
|
||||
public long getNewDifficultyTarget(int previousHeight, long previousBlockTime,
|
||||
final long lastDifficultyTarget, final long lastRetargetTime) {
|
||||
final int height = previousHeight + 1;
|
||||
final boolean digishieldAlgorithm = height >= this.getDigishieldBlockHeight();
|
||||
|
@ -54,6 +54,7 @@ public class DogecoinBlockTest {
|
||||
final AltcoinBlock block = (AltcoinBlock)serializer.makeBlock(payload);
|
||||
assertEquals("82bc68038f6034c0596b6e313729793a887fded6e92a31fbdf70863f89d9bea2", block.getHashAsString());
|
||||
assertEquals(1, block.getTransactions().size());
|
||||
assertEquals(0x1e0ffff0L, block.getDifficultyTarget());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user