Skip to content

Commit

Permalink
narrow down the scope of the variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Jun 21, 2023
1 parent 03942f3 commit 421bdef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/txpool/txpool.go
Expand Up @@ -1265,7 +1265,6 @@ func (pool *TxPool) 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 All @@ -1286,6 +1285,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
"old", oldHead.Hash(), "oldnum", oldNum, "new", newHead.Hash(), "newnum", newNum)
// We still need to update the current state s.th. the lost transactions can be readded by the user
} else {
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 421bdef

Please sign in to comment.