Correct difficulty calculation to use new difficulty minimum
This commit is contained in:
parent
5d31a475e9
commit
becc503230
@ -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…
Reference in New Issue
Block a user