mempool: use capacity parameter to avoid map reallocations
Which is what happens in AddBlock that fills a new pool with exactly the number of transactions we know already.
This commit is contained in:
parent
e236ac4067
commit
428ba48444
1 changed files with 1 additions and 1 deletions
|
@ -422,7 +422,7 @@ func (mp *Pool) checkPolicy(tx *transaction.Transaction, policyChanged bool) boo
|
||||||
// New returns a new Pool struct.
|
// New returns a new Pool struct.
|
||||||
func New(capacity int, payerIndex int, enableSubscriptions bool) *Pool {
|
func New(capacity int, payerIndex int, enableSubscriptions bool) *Pool {
|
||||||
mp := &Pool{
|
mp := &Pool{
|
||||||
verifiedMap: make(map[util.Uint256]*transaction.Transaction),
|
verifiedMap: make(map[util.Uint256]*transaction.Transaction, capacity),
|
||||||
verifiedTxes: make([]item, 0, capacity),
|
verifiedTxes: make([]item, 0, capacity),
|
||||||
capacity: capacity,
|
capacity: capacity,
|
||||||
payerIndex: payerIndex,
|
payerIndex: payerIndex,
|
||||||
|
|
Loading…
Reference in a new issue