mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 22:43:47 +00:00
core: return early if scheduled fork's timestamp can't be retrieved
This commit is contained in:
parent
62eda99668
commit
efbfd60222
2 changed files with 5 additions and 4 deletions
|
|
@ -2471,10 +2471,11 @@ func (bc *BlockChain) reportBlock(block *types.Block, res *ProcessResult, err er
|
||||||
func (bc *BlockChain) logForkReadiness(block *types.Block) {
|
func (bc *BlockChain) logForkReadiness(block *types.Block) {
|
||||||
c := bc.Config()
|
c := bc.Config()
|
||||||
current, last := c.LatestFork(block.Time()), c.LatestFork(math.MaxUint64)
|
current, last := c.LatestFork(block.Time()), c.LatestFork(math.MaxUint64)
|
||||||
var at time.Time
|
t := c.Timestamp(last)
|
||||||
if t := c.Timestamp(last); t != nil {
|
if t == nil {
|
||||||
at = time.Unix(int64(*t), 0)
|
return
|
||||||
}
|
}
|
||||||
|
at := time.Unix(int64(*t), 0)
|
||||||
if current < last && time.Now().After(bc.lastForkReadyAlert.Add(forkReadyInterval)) {
|
if current < last && time.Now().After(bc.lastForkReadyAlert.Add(forkReadyInterval)) {
|
||||||
log.Info("Ready for fork activation", "fork", last, "date", at.Format(time.RFC822),
|
log.Info("Ready for fork activation", "fork", last, "date", at.Format(time.RFC822),
|
||||||
"remaining", time.Until(at).Round(time.Second), "timestamp", at.Unix())
|
"remaining", time.Until(at).Round(time.Second), "timestamp", at.Unix())
|
||||||
|
|
|
||||||
|
|
@ -888,7 +888,7 @@ func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
|
||||||
case fork == forks.Shanghai:
|
case fork == forks.Shanghai:
|
||||||
return c.ShanghaiTime
|
return c.ShanghaiTime
|
||||||
default:
|
default:
|
||||||
panic("unknown timestamp fork requested")
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue