check difficulty for nil (#7978)

Fix checks `chainConfig.TerminalTotalDifficulty` for nil in
`isChainPoS`. Not doing so causes the Bor startup flow to panic.
This commit is contained in:
Mark Holt 2023-08-08 22:26:59 +01:00 committed by GitHub
parent 6081fe01b8
commit 6bd58f7c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1255,5 +1255,7 @@ func isChainPoS(chainConfig *chain.Config, currentTD *big.Int) bool {
id == 5 ||
id == 11155111 ||
id == 100 ||
id == 10200 || chainConfig.TerminalTotalDifficulty.Cmp(currentTD) <= 0 || chainConfig.TerminalTotalDifficultyPassed
id == 10200 ||
(chainConfig.TerminalTotalDifficulty != nil && chainConfig.TerminalTotalDifficulty.Cmp(currentTD) <= 0) ||
chainConfig.TerminalTotalDifficultyPassed
}