From cadb9e8bfe84c04b523abd85138caa307f4c2a61 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 11 Jul 2016 12:32:24 -0400 Subject: [PATCH] mempool: don't remove committed txs from cache --- mempool/mempool.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/mempool/mempool.go b/mempool/mempool.go index 0833cb4a6..6cd2227c2 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -304,19 +304,13 @@ func (mem *Mempool) filterTxs(blockTxsMap map[string]struct{}) []types.Tx { goodTxs := make([]types.Tx, 0, mem.txs.Len()) for e := mem.txs.Front(); e != nil; e = e.Next() { memTx := e.Value.(*mempoolTx) - // Remove the tx if its alredy in a block. + // Remove the tx if it's alredy in a block. if _, ok := blockTxsMap[string(memTx.tx)]; ok { // remove from clist mem.txs.Remove(e) e.DetachPrev() - // remove from mempool cache - // we only enforce "at-least once" semantics and - // leave it to the application to implement "only-once" - // via eg. sequence numbers, utxos, etc. - // NOTE: expects caller of filterTxs to hold the lock - // (so we can't use mem.removeTxFromCacheMap) - delete(mem.cacheMap, string(memTx.tx)) + // NOTE: we don't remove committed txs from the cache. continue } // Good tx!