Skip to content

Commit

Permalink
[release/1.4.4] core: fixed pointer assignment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
obscuren committed May 12, 2016
1 parent 594328c commit aa18aad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit aa18aad

Please sign in to comment.