Correct difficulty calculation to use new difficulty minimum

This commit is contained in:
Gustav Simonsson 2015-03-23 16:31:50 +01:00
parent 5d31a475e9
commit becc503230

View File

@ -32,8 +32,10 @@ type StateQuery interface {
func CalcDifficulty(block, parent *types.Header) *big.Int { func CalcDifficulty(block, parent *types.Header) *big.Int {
diff := new(big.Int) diff := new(big.Int)
min := big.NewInt(2048) diffBoundDiv := big.NewInt(2048)
adjust := new(big.Int).Div(parent.Difficulty, min) min := big.NewInt(131072)
adjust := new(big.Int).Div(parent.Difficulty, diffBoundDiv)
if (block.Time - parent.Time) < 8 { if (block.Time - parent.Time) < 8 {
diff.Add(parent.Difficulty, adjust) diff.Add(parent.Difficulty, adjust)
} else { } else {