diff --git a/config/tendermint/config.go b/config/tendermint/config.go index 74d7aefeb..779b54403 100644 --- a/config/tendermint/config.go +++ b/config/tendermint/config.go @@ -79,6 +79,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("timeout_precommit_delta", 500) mapConfig.SetDefault("timeout_commit", 1000) mapConfig.SetDefault("mempool_recheck", true) + mapConfig.SetDefault("mempool_recheck_empty", true) mapConfig.SetDefault("mempool_broadcast", true) return mapConfig diff --git a/config/tendermint_test/config.go b/config/tendermint_test/config.go index c2690ae90..c022894bf 100644 --- a/config/tendermint_test/config.go +++ b/config/tendermint_test/config.go @@ -97,6 +97,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("timeout_precommit_delta", 1) mapConfig.SetDefault("timeout_commit", 1) mapConfig.SetDefault("mempool_recheck", true) + mapConfig.SetDefault("mempool_recheck_empty", true) mapConfig.SetDefault("mempool_broadcast", true) return mapConfig diff --git a/mempool/mempool.go b/mempool/mempool.go index 44b59f973..3688a23e3 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -245,8 +245,11 @@ func (mem *Mempool) Update(height int, txs []types.Tx) { mem.height = height // Remove transactions that are already in txs. goodTxs := mem.filterTxs(txsMap) - // Recheck mempool txs - if config.GetBool("mempool_recheck") { + // Recheck mempool txs if any txs were committed in the block + // NOTE/XXX: in some apps a tx could be invalidated due to EndBlock, + // so we really still do need to recheck, but this is for debugging + if config.GetBool("mempool_recheck") && + (config.GetBool("mempool_recheck_empty") || len(txs) > 0) { log.Info("Recheck txs", "numtxs", len(goodTxs)) mem.recheckTxs(goodTxs) // At this point, mem.txs are being rechecked.