Skip to content

Commit aa18aad

Browse files
committed
[release/1.4.4] core: fixed pointer assignment
This fixes an issue where it's theoretical possible to cause a consensus failure when hitting the lower end of the difficulty, though pratically impossible it's worth a fix.
1 parent 594328c commit aa18aad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/block_validator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func calcDifficultyHomestead(time, parentTime uint64, parentNumber, parentDiff *
292292

293293
// minimum difficulty can ever be (before exponential factor)
294294
if x.Cmp(params.MinimumDifficulty) < 0 {
295-
x = params.MinimumDifficulty
295+
x.Set(params.MinimumDifficulty)
296296
}
297297

298298
// for the exponential factor
@@ -325,7 +325,7 @@ func calcDifficultyFrontier(time, parentTime uint64, parentNumber, parentDiff *b
325325
diff.Sub(parentDiff, adjust)
326326
}
327327
if diff.Cmp(params.MinimumDifficulty) < 0 {
328-
diff = params.MinimumDifficulty
328+
diff.Set(params.MinimumDifficulty)
329329
}
330330

331331
periodCount := new(big.Int).Add(parentNumber, common.Big1)

0 commit comments

Comments
 (0)