From 9a167c45d1650653e9618977cb08c6f453bb6f70 Mon Sep 17 00:00:00 2001 From: hero5512 Date: Mon, 19 Jun 2023 17:30:39 -0400 Subject: [PATCH] core/txpool/legacypool: narrow down the scope of the variable (#27471) Variables discarded, included can be defined closer to their usage. Co-authored-by: Martin Holst Swende --- core/txpool/legacypool/legacypool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 3464fe212f..02cd53ab96 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1262,7 +1262,6 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) { log.Debug("Skipping deep transaction reorg", "depth", depth) } else { // Reorg seems shallow enough to pull in all transactions into memory - var discarded, included types.Transactions var ( rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64()) add = pool.chain.GetBlock(newHead.Hash(), newHead.Number.Uint64()) @@ -1291,6 +1290,7 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) { log.Warn("New head missing in txpool reset", "number", newHead.Number, "hash", newHead.Hash()) return } + var discarded, included types.Transactions for rem.NumberU64() > add.NumberU64() { discarded = append(discarded, rem.Transactions()...) if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil {