@@ -11,6 +11,7 @@ import (
1111 "strings"
1212 "time"
1313
14+ mempoolcfg "github.com/sei-protocol/sei-chain/sei-tendermint/internal/mempool"
1415 tmos "github.com/sei-protocol/sei-chain/sei-tendermint/libs/os"
1516 "github.com/sei-protocol/sei-chain/sei-tendermint/types"
1617)
@@ -857,38 +858,60 @@ type MempoolConfig struct {
857858 DropPriorityReservoirSize int `mapstructure:"drop-priority-reservoir-size"`
858859}
859860
861+ func (cfg * MempoolConfig ) ToMempoolConfig () * mempoolcfg.Config {
862+ return & mempoolcfg.Config {
863+ Size : cfg .Size ,
864+ MaxTxsBytes : cfg .MaxTxsBytes ,
865+ CacheSize : cfg .CacheSize ,
866+ DuplicateTxsCacheSize : cfg .DuplicateTxsCacheSize ,
867+ KeepInvalidTxsInCache : cfg .KeepInvalidTxsInCache ,
868+ MaxTxBytes : cfg .MaxTxBytes ,
869+ TTLDuration : cfg .TTLDuration ,
870+ TTLNumBlocks : cfg .TTLNumBlocks ,
871+ TxNotifyThreshold : cfg .TxNotifyThreshold ,
872+ PendingSize : cfg .PendingSize ,
873+ MaxPendingTxsBytes : cfg .MaxPendingTxsBytes ,
874+ RemoveExpiredTxsFromQueue : cfg .RemoveExpiredTxsFromQueue ,
875+ DropPriorityThreshold : cfg .DropPriorityThreshold ,
876+ DropUtilisationThreshold : cfg .DropUtilisationThreshold ,
877+ DropPriorityReservoirSize : cfg .DropPriorityReservoirSize ,
878+ }
879+ }
880+
860881// DefaultMempoolConfig returns a default configuration for the Tendermint mempool.
861882func DefaultMempoolConfig () * MempoolConfig {
883+ cfg := mempoolcfg .DefaultConfig ()
862884 return & MempoolConfig {
863- Broadcast : true ,
864- // Each signature verification takes .5ms, Size reduced until we implement
865- // ABCI Recheck
866- Size : 5000 ,
867- MaxTxsBytes : 1024 * 1024 * 1024 , // 1GB
868- CacheSize : 10000 ,
869- DuplicateTxsCacheSize : 100000 ,
870- MaxTxBytes : 1024 * 1024 , // 1MB
871- TTLDuration : 5 * time . Second , // prevent stale txs from filling mempool
872- TTLNumBlocks : 10 , // remove txs after 10 blocks
873- TxNotifyThreshold : 0 ,
885+ Broadcast : true ,
886+ Size : cfg . Size ,
887+ MaxTxsBytes : cfg . MaxTxsBytes ,
888+ CacheSize : cfg . CacheSize ,
889+ DuplicateTxsCacheSize : cfg . DuplicateTxsCacheSize ,
890+ KeepInvalidTxsInCache : cfg . KeepInvalidTxsInCache ,
891+ MaxTxBytes : cfg . MaxTxBytes ,
892+ MaxBatchBytes : 0 ,
893+ TTLDuration : cfg . TTLDuration ,
894+ TTLNumBlocks : cfg . TTLNumBlocks ,
895+ TxNotifyThreshold : cfg . TxNotifyThreshold ,
874896 CheckTxErrorBlacklistEnabled : true ,
875897 CheckTxErrorThreshold : 50 ,
876- PendingSize : 5000 ,
877- MaxPendingTxsBytes : 1024 * 1024 * 1024 , // 1GB
878- PendingTTLDuration : 0 * time . Second ,
898+ PendingSize : cfg . PendingSize ,
899+ MaxPendingTxsBytes : cfg . MaxPendingTxsBytes ,
900+ PendingTTLDuration : 0 ,
879901 PendingTTLNumBlocks : 0 ,
880- RemoveExpiredTxsFromQueue : true ,
881- DropPriorityThreshold : 0.1 ,
882- DropUtilisationThreshold : 1.0 ,
883- DropPriorityReservoirSize : 10_240 ,
902+ RemoveExpiredTxsFromQueue : cfg . RemoveExpiredTxsFromQueue ,
903+ DropPriorityThreshold : cfg . DropPriorityThreshold ,
904+ DropUtilisationThreshold : cfg . DropUtilisationThreshold ,
905+ DropPriorityReservoirSize : cfg . DropPriorityReservoirSize ,
884906 }
885907}
886908
887909// TestMempoolConfig returns a configuration for testing the Tendermint mempool
888910func TestMempoolConfig () * MempoolConfig {
889911 cfg := DefaultMempoolConfig ()
890- cfg .CacheSize = 1000
891- cfg .DropUtilisationThreshold = 0.0
912+ testCfg := mempoolcfg .TestConfig ()
913+ cfg .CacheSize = testCfg .CacheSize
914+ cfg .DropUtilisationThreshold = testCfg .DropUtilisationThreshold
892915 return cfg
893916}
894917
0 commit comments