Skip to content

Commit

Permalink
core/txpool/legacypool: narrow down the scope of the variable (ethere…
Browse files Browse the repository at this point in the history
…um#27471)

Variables discarded, included can be defined closer to their usage.

Co-authored-by: Martin Holst Swende <martin@swende.se>
  • Loading branch information
2 people authored and spencer-tb committed Jul 7, 2023
1 parent b210dca commit a8e4488
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,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())
Expand Down Expand Up @@ -1302,6 +1301,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 {
Expand Down

0 comments on commit a8e4488

Please sign in to comment.