Browse Source

allow no recheck if empty block

pull/206/merge
Ethan Buchman 9 years ago
committed by Jae Kwon
parent
commit
850d769273
3 changed files with 7 additions and 2 deletions
  1. +1
    -0
      config/tendermint/config.go
  2. +1
    -0
      config/tendermint_test/config.go
  3. +5
    -2
      mempool/mempool.go

+ 1
- 0
config/tendermint/config.go View File

@ -79,6 +79,7 @@ func GetConfig(rootDir string) cfg.Config {
mapConfig.SetDefault("timeout_precommit_delta", 500) mapConfig.SetDefault("timeout_precommit_delta", 500)
mapConfig.SetDefault("timeout_commit", 1000) mapConfig.SetDefault("timeout_commit", 1000)
mapConfig.SetDefault("mempool_recheck", true) mapConfig.SetDefault("mempool_recheck", true)
mapConfig.SetDefault("mempool_recheck_empty", true)
mapConfig.SetDefault("mempool_broadcast", true) mapConfig.SetDefault("mempool_broadcast", true)
return mapConfig return mapConfig


+ 1
- 0
config/tendermint_test/config.go View File

@ -97,6 +97,7 @@ func GetConfig(rootDir string) cfg.Config {
mapConfig.SetDefault("timeout_precommit_delta", 1) mapConfig.SetDefault("timeout_precommit_delta", 1)
mapConfig.SetDefault("timeout_commit", 1) mapConfig.SetDefault("timeout_commit", 1)
mapConfig.SetDefault("mempool_recheck", true) mapConfig.SetDefault("mempool_recheck", true)
mapConfig.SetDefault("mempool_recheck_empty", true)
mapConfig.SetDefault("mempool_broadcast", true) mapConfig.SetDefault("mempool_broadcast", true)
return mapConfig return mapConfig


+ 5
- 2
mempool/mempool.go View File

@ -245,8 +245,11 @@ func (mem *Mempool) Update(height int, txs []types.Tx) {
mem.height = height mem.height = height
// Remove transactions that are already in txs. // Remove transactions that are already in txs.
goodTxs := mem.filterTxs(txsMap) 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)) log.Info("Recheck txs", "numtxs", len(goodTxs))
mem.recheckTxs(goodTxs) mem.recheckTxs(goodTxs)
// At this point, mem.txs are being rechecked. // At this point, mem.txs are being rechecked.


Loading…
Cancel
Save