@@ -254,6 +254,23 @@ class EthashBlockHeaderValidatorSpec
254
254
difficulty shouldBe afterRewardReductionBlockHeader.difficulty
255
255
}
256
256
257
+ it should " properly calculate the difficulty after muir glacier delay" in new EphemBlockchainTestSetup {
258
+ val blockchainConfigWithoutDifficultyBombRemoval : BlockchainConfig =
259
+ blockchainConfig.withUpdatedForkBlocks(_.copy(difficultyBombRemovalBlockNumber = BigInt (" 1000000000000" ), difficultyBombPauseBlockNumber = 0 , difficultyBombContinueBlockNumber = 0 , muirGlacierBlockNumber = 9200000 ))
260
+
261
+ val parentHeader : BlockHeader =
262
+ validParentBlockHeader.copy(number = 9200000 - 1 , unixTimestamp = 1525176000 , difficulty = BigInt (" 22627021745803" ))
263
+ val parent = Block (parentHeader, parentBody)
264
+
265
+ val blockNumber : BigInt = parentHeader.number + 1
266
+ val blockTimestamp : Long = parentHeader.unixTimestamp + 6
267
+
268
+ val difficulty : BigInt = EthashDifficultyCalculator .calculateDifficulty(blockNumber, blockTimestamp, parent.header)(blockchainConfigWithoutDifficultyBombRemoval)
269
+ val blockDifficultyWihtoutBomb = BigInt (" 22638070096265" )
270
+
271
+ difficulty shouldBe blockDifficultyWihtoutBomb
272
+ }
273
+
257
274
// FIXME: Replace with mocked miner validators once we have them
258
275
object BlockValidatorWithPowMocked extends BlockHeaderValidatorSkeleton () {
259
276
@@ -388,6 +405,7 @@ class EthashBlockHeaderValidatorSpec
388
405
byzantiumBlockNumber = 4370000 ,
389
406
constantinopleBlockNumber = 7280000 ,
390
407
istanbulBlockNumber = 9069000 ,
408
+ muirGlacierBlockNumber = 9200000 ,
391
409
eip106BlockNumber = 0
392
410
),
393
411
daoForkConfig = Some (new DaoForkConfig {
0 commit comments