mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-27 08:07:22 +00:00
core: check for parent in calc TD. TD = (N != 0 == parent.TD) || (== D)
This commit is contained in:
parent
28b39267d9
commit
e4dba36892
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue