feat: default to noop mempool when max-txs is negative (#16071)

This commit is contained in:
Julien Robert
2023-05-09 17:41:20 +00:00
committed by GitHub
parent 2f21cb5050
commit 0da5e83176
3 changed files with 27 additions and 5 deletions
+10 -5
View File
@@ -487,6 +487,15 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) {
cast.ToUint32(appOpts.Get(FlagStateSyncSnapshotKeepRecent)),
)
defaultMempool := baseapp.SetMempool(mempool.NoOpMempool{})
if maxTxs := cast.ToInt(appOpts.Get(FlagMempoolMaxTxs)); maxTxs >= 0 {
defaultMempool = baseapp.SetMempool(
mempool.NewSenderNonceMempool(
mempool.SenderNonceMaxTxOpt(maxTxs),
),
)
}
return []func(*baseapp.BaseApp){
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(FlagMinGasPrices))),
@@ -499,11 +508,7 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) {
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(FlagIAVLCacheSize))),
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(FlagDisableIAVLFastNode))),
baseapp.SetMempool(
mempool.NewSenderNonceMempool(
mempool.SenderNonceMaxTxOpt(cast.ToInt(appOpts.Get(FlagMempoolMaxTxs))),
),
),
defaultMempool,
baseapp.SetIAVLLazyLoading(cast.ToBool(appOpts.Get(FlagIAVLLazyLoading))),
baseapp.SetChainID(chainID),
}