core: return early if scheduled fork's timestamp can't be retrieved

This commit is contained in:
lightclient 2025-03-08 22:16:53 +01:00
parent 62eda99668
commit efbfd60222
No known key found for this signature in database
GPG key ID: 657913021EF45A6A
2 changed files with 5 additions and 4 deletions

View file

@ -2471,10 +2471,11 @@ func (bc *BlockChain) reportBlock(block *types.Block, res *ProcessResult, err er
func (bc *BlockChain) logForkReadiness(block *types.Block) {
c := bc.Config()
current, last := c.LatestFork(block.Time()), c.LatestFork(math.MaxUint64)
var at time.Time
if t := c.Timestamp(last); t != nil {
at = time.Unix(int64(*t), 0)
t := c.Timestamp(last)
if t == nil {
return
}
at := time.Unix(int64(*t), 0)
if current < last && time.Now().After(bc.lastForkReadyAlert.Add(forkReadyInterval)) {
log.Info("Ready for fork activation", "fork", last, "date", at.Format(time.RFC822),
"remaining", time.Until(at).Round(time.Second), "timestamp", at.Unix())

View file

@ -888,7 +888,7 @@ func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
case fork == forks.Shanghai:
return c.ShanghaiTime
default:
panic("unknown timestamp fork requested")
return nil
}
}