Skip to content

Commit 7c6914c

Browse files
asdacapfjl
andauthored
simulators/ethereum/engine: Fix wrong TD calculation (#629)
* Fix wrong TD calculated * Update helper.go Co-authored-by: Felix Lange <[email protected]>
1 parent 70913f3 commit 7c6914c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

simulators/ethereum/engine/helper/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ func LoadGenesisBlock(path string) *types.Block {
190190
func CalculateTotalDifficulty(genesis core.Genesis, chain types.Blocks, lastBlock uint64) *big.Int {
191191
result := new(big.Int).Set(genesis.Difficulty)
192192
for _, b := range chain {
193+
result.Add(result, b.Difficulty())
193194
if lastBlock != 0 && lastBlock == b.NumberU64() {
194195
break
195196
}
196-
result.Add(result, b.Difficulty())
197197
}
198198
return result
199199
}

0 commit comments

Comments
 (0)