set capacity of txsmap (#2166)

This commit is contained in:
Jun Kimura
2018-08-08 01:50:10 +09:00
committed by Anton Kaliaev
parent ec3e34efd8
commit e1b9bf7c81

View File

@@ -401,7 +401,7 @@ func (mem *Mempool) collectTxs(maxTxs int) types.Txs {
// NOTE: unsafe; Lock/Unlock must be managed by caller
func (mem *Mempool) Update(height int64, txs types.Txs) error {
// First, create a lookup map of txns in new txs.
txsMap := make(map[string]struct{})
txsMap := make(map[string]struct{}, len(txs))
for _, tx := range txs {
txsMap[string(tx)] = struct{}{}
}