From bc514394f2b322b1d74ac5d48778f272736c2956 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Fri, 29 Nov 2024 10:20:44 +0800 Subject: [PATCH] fix panic: sync.Map range might got nil pointer --- core/txpool/legacypool/legacypool.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 351e2dfbc..32102b7d8 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -491,7 +491,10 @@ func (pool *LegacyPool) loop() { if pool.locals.contains(addr) { return true } - beat, _ := pool.beats.Load(addr) + beat, ok := pool.beats.Load(addr) + if !ok { + return true + } if time.Since(beat.(time.Time)) > pool.config.Lifetime { list := txs.Flatten() for _, tx := range list {