Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehao committed Apr 7, 2024
1 parent 5b103b6 commit 44c10a6
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1682,10 +1682,7 @@ func (as *accountSet) containsTx(tx *types.Transaction) bool {
// add inserts a new address into the set to track.
func (as *accountSet) add(addr common.Address) {
as.accounts[addr] = struct{}{}
if as.cache != nil {
addrsPool.Put((*as.cache)[:0])
as.cache = nil
}
as.cache = nil
}

// addTx adds the sender of tx into the set.
Expand All @@ -1699,7 +1696,7 @@ func (as *accountSet) addTx(tx *types.Transaction) {
// reuse. The returned slice should not be changed!
func (as *accountSet) flatten() []common.Address {
if as.cache == nil {
accounts := addrsPool.Get().([]common.Address)
accounts := make([]common.Address, 0, len(as.accounts))
for account := range as.accounts {
accounts = append(accounts, account)
}
Expand All @@ -1713,10 +1710,7 @@ func (as *accountSet) merge(other *accountSet) {
for addr := range other.accounts {
as.accounts[addr] = struct{}{}
}
if as.cache != nil {
addrsPool.Put((*as.cache)[:0])
as.cache = nil
}
as.cache = nil
}

// txLookup is used internally by TxPool to track transactions while allowing
Expand Down

0 comments on commit 44c10a6

Please sign in to comment.