forked from cerc-io/plugeth
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>
This commit is contained in:
parent
ceca4578ca
commit
9a167c45d1
@ -1262,7 +1262,6 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) {
|
|||||||
log.Debug("Skipping deep transaction reorg", "depth", depth)
|
log.Debug("Skipping deep transaction reorg", "depth", depth)
|
||||||
} else {
|
} else {
|
||||||
// Reorg seems shallow enough to pull in all transactions into memory
|
// Reorg seems shallow enough to pull in all transactions into memory
|
||||||
var discarded, included types.Transactions
|
|
||||||
var (
|
var (
|
||||||
rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64())
|
rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64())
|
||||||
add = pool.chain.GetBlock(newHead.Hash(), newHead.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())
|
log.Warn("New head missing in txpool reset", "number", newHead.Number, "hash", newHead.Hash())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var discarded, included types.Transactions
|
||||||
for rem.NumberU64() > add.NumberU64() {
|
for rem.NumberU64() > add.NumberU64() {
|
||||||
discarded = append(discarded, rem.Transactions()...)
|
discarded = append(discarded, rem.Transactions()...)
|
||||||
if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil {
|
if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user