mempool: fix cache_size==0. closes #1761

This commit is contained in:
Ethan Buchman 2018-06-18 18:18:52 -07:00
parent 6a324764ac
commit 4b2348f697
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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
}