core: preallocate maps in TxPool helper methods (#25737)
This commit is contained in:
parent
0c1888a367
commit
3a4cef5402
@ -498,11 +498,11 @@ func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common
|
|||||||
pool.mu.Lock()
|
pool.mu.Lock()
|
||||||
defer pool.mu.Unlock()
|
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 {
|
for addr, list := range pool.pending {
|
||||||
pending[addr] = list.Flatten()
|
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 {
|
for addr, list := range pool.queue {
|
||||||
queued[addr] = list.Flatten()
|
queued[addr] = list.Flatten()
|
||||||
}
|
}
|
||||||
@ -1588,7 +1588,7 @@ type accountSet struct {
|
|||||||
// derivations.
|
// derivations.
|
||||||
func newAccountSet(signer types.Signer, addrs ...common.Address) *accountSet {
|
func newAccountSet(signer types.Signer, addrs ...common.Address) *accountSet {
|
||||||
as := &accountSet{
|
as := &accountSet{
|
||||||
accounts: make(map[common.Address]struct{}),
|
accounts: make(map[common.Address]struct{}, len(addrs)),
|
||||||
signer: signer,
|
signer: signer,
|
||||||
}
|
}
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
|
Loading…
Reference in New Issue
Block a user