aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-05-12 22:58:05 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-05-12 23:31:57 +0800
commitaa18aad7adb4c80a36f6c5f84561280420212231 (patch)
tree6419e5e9f374aca223c16416fdc42d871bd3b8fa
parent594328c1121f997748cc5fe87f493db94827e1ec (diff)
downloadgo-tangerine-aa18aad7adb4c80a36f6c5f84561280420212231.tar
go-tangerine-aa18aad7adb4c80a36f6c5f84561280420212231.tar.gz
go-tangerine-aa18aad7adb4c80a36f6c5f84561280420212231.tar.bz2
go-tangerine-aa18aad7adb4c80a36f6c5f84561280420212231.tar.lz
go-tangerine-aa18aad7adb4c80a36f6c5f84561280420212231.tar.xz
go-tangerine-aa18aad7adb4c80a36f6c5f84561280420212231.tar.zst
go-tangerine-aa18aad7adb4c80a36f6c5f84561280420212231.zip
[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.
-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)