Correct difficulty calculation to use new difficulty minimum

pull/537/head
Gustav Simonsson 10 years ago
parent 5d31a475e9
commit becc503230
  1. 6
      core/chain_manager.go

@ -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 {

Loading…
Cancel
Save