mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-21 14:14:30 +00:00
core: preallocate maps in TxPool helper methods (#25737)
This commit is contained in:
parent
e4153f756d
commit
a410f7b38e
1 changed files with 3 additions and 3 deletions
|
|
@ -534,11 +534,11 @@ func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common
|
|||
pool.mu.Lock()
|
||||
defer pool.mu.Unlock()
|
||||
|
||||
pending := make(map[common.Address]types.Transactions)
|
||||
pending := make(map[common.Address]types.Transactions, len(pool.pending))
|
||||
for addr, list := range pool.pending {
|
||||
pending[addr] = list.Flatten()
|
||||
}
|
||||
queued := make(map[common.Address]types.Transactions)
|
||||
queued := make(map[common.Address]types.Transactions, len(pool.queue))
|
||||
for addr, list := range pool.queue {
|
||||
queued[addr] = list.Flatten()
|
||||
}
|
||||
|
|
@ -1752,7 +1752,7 @@ type accountSet struct {
|
|||
// derivations.
|
||||
func newAccountSet(signer types.Signer, addrs ...common.Address) *accountSet {
|
||||
as := &accountSet{
|
||||
accounts: make(map[common.Address]struct{}),
|
||||
accounts: make(map[common.Address]struct{}, len(addrs)),
|
||||
signer: signer,
|
||||
}
|
||||
for _, addr := range addrs {
|
||||
|
|
|
|||
Loading…
Reference in a new issue