Commit e4dba368 authored by obscuren's avatar obscuren

core: check for parent in calc TD. TD = (N != 0 == parent.TD) || (== D)

parent 28b39267
......@@ -49,6 +49,10 @@ func CalcDifficulty(block, parent *types.Header) *big.Int {
}
func CalculateTD(block, parent *types.Block) *big.Int {
if parent == nil {
return block.Difficulty()
}
td := new(big.Int).Add(parent.Td, block.Header().Difficulty)
return td
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment