Anton Kaliaev 6 years ago
parent
commit
ae572b9038
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 1 additions and 10 deletions
  1. +1
    -10
      mempool/mempool.go

+ 1
- 10
mempool/mempool.go View File

@ -203,10 +203,9 @@ func (mem *Mempool) CheckTx(tx types.Tx, cb func(*abci.Response)) (err error) {
defer mem.proxyMtx.Unlock()
// CACHE
if mem.cache.Exists(tx) {
if !mem.cache.Push(tx) {
return ErrTxInCache
}
mem.cache.Push(tx)
// END CACHE
// WAL
@ -463,14 +462,6 @@ func (cache *txCache) Reset() {
cache.mtx.Unlock()
}
// Exists returns true if the given tx is cached.
func (cache *txCache) Exists(tx types.Tx) bool {
cache.mtx.Lock()
_, exists := cache.map_[string(tx)]
cache.mtx.Unlock()
return exists
}
// Push adds the given tx to the txCache. It returns false if tx is already in the cache.
func (cache *txCache) Push(tx types.Tx) bool {
cache.mtx.Lock()


Loading…
Cancel
Save