From 4b2348f697d9b2019547693555522ae50a4ed037 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 18 Jun 2018 18:18:52 -0700 Subject: [PATCH] mempool: fix cache_size==0. closes #1761 --- CHANGELOG.md | 3 ++- mempool/mempool.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed524e508..3c484fea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ BUG FIXES -[consensus] Fix #1754 where we don't make blocks when `create_empty_blocks=false` +- [consensus] Fix #1754 where we don't make blocks when `create_empty_blocks=false` +- [mempool] Fix #1761 where we don't process txs if `cache_size=0` ## 0.20.0 diff --git a/mempool/mempool.go b/mempool/mempool.go index bde4984b1..1ed718091 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -478,6 +478,11 @@ func (cache *txCache) Push(tx types.Tx) bool { cache.mtx.Lock() defer cache.mtx.Unlock() + // if cache size is 0, do nothing + if cache.size == 0 { + return true + } + if _, exists := cache.map_[string(tx)]; exists { return false }