allow no recheck if empty block

This commit is contained in:
Ethan Buchman
2016-04-29 14:23:04 -07:00
committed by Jae Kwon
parent 39344a601d
commit 850d769273
3 changed files with 7 additions and 2 deletions
+1
View File
@@ -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
+1
View File
@@ -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
+5 -2
View File
@@ -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.