aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-05-12 22:58:05 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-05-13 18:12:46 +0800
commitfe532a98f9f32bb81ef0d8d013cf44327830d11e (patch)
tree1e568ea30b17f4cc8caed87fd5fe431ea1e5bf79 /core
parent39ce85cf5d119ef830561ecdc4096bfe565bc5c1 (diff)
downloaddexon-fe532a98f9f32bb81ef0d8d013cf44327830d11e.tar.gz
dexon-fe532a98f9f32bb81ef0d8d013cf44327830d11e.tar.zst
dexon-fe532a98f9f32bb81ef0d8d013cf44327830d11e.zip
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.
Diffstat (limited to 'core')
-rw-r--r--core/block_validator.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/block_validator.go b/core/block_validator.go
index 555c5ee06..801d2572b 100644
--- a/core/block_validator.go
+++ b/core/block_validator.go
@@ -292,7 +292,7 @@ func calcDifficultyHomestead(time, parentTime uint64, parentNumber, parentDiff *
// minimum difficulty can ever be (before exponential factor)
if x.Cmp(params.MinimumDifficulty) < 0 {
- x = params.MinimumDifficulty
+ x.Set(params.MinimumDifficulty)
}
// for the exponential factor
@@ -325,7 +325,7 @@ func calcDifficultyFrontier(time, parentTime uint64, parentNumber, parentDiff *b
diff.Sub(parentDiff, adjust)
}
if diff.Cmp(params.MinimumDifficulty) < 0 {
- diff = params.MinimumDifficulty
+ diff.Set(params.MinimumDifficulty)
}
periodCount := new(big.Int).Add(parentNumber, common.Big1)