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 <martin@swende.se>
pull/27521/head
hero5512 1 year ago committed by GitHub
parent ceca4578ca
commit 9a167c45d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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 {

Loading…
Cancel
Save