@@ -254,6 +254,36 @@ 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(
260
+ _.copy(
261
+ difficultyBombRemovalBlockNumber = BigInt (" 1000000000000" ),
262
+ difficultyBombPauseBlockNumber = 0 ,
263
+ difficultyBombContinueBlockNumber = 0 ,
264
+ muirGlacierBlockNumber = 9200000
265
+ )
266
+ )
267
+
268
+ val parentHeader : BlockHeader =
269
+ validParentBlockHeader.copy(
270
+ number = 9200000 - 1 ,
271
+ unixTimestamp = 1525176000 ,
272
+ difficulty = BigInt (" 22627021745803" )
273
+ )
274
+ val parent = Block (parentHeader, parentBody)
275
+
276
+ val blockNumber : BigInt = parentHeader.number + 1
277
+ val blockTimestamp : Long = parentHeader.unixTimestamp + 6
278
+
279
+ val difficulty : BigInt = EthashDifficultyCalculator .calculateDifficulty(blockNumber, blockTimestamp, parent.header)(
280
+ blockchainConfigWithoutDifficultyBombRemoval
281
+ )
282
+ val blockDifficultyWihtoutBomb = BigInt (" 22638070096265" )
283
+
284
+ difficulty shouldBe blockDifficultyWihtoutBomb
285
+ }
286
+
257
287
// FIXME: Replace with mocked miner validators once we have them
258
288
object BlockValidatorWithPowMocked extends BlockHeaderValidatorSkeleton () {
259
289
@@ -388,6 +418,7 @@ class EthashBlockHeaderValidatorSpec
388
418
byzantiumBlockNumber = 4370000 ,
389
419
constantinopleBlockNumber = 7280000 ,
390
420
istanbulBlockNumber = 9069000 ,
421
+ muirGlacierBlockNumber = 9200000 ,
391
422
eip106BlockNumber = 0
392
423
),
393
424
daoForkConfig = Some (new DaoForkConfig {
0 commit comments