diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 12138335c..84cd5b6db 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -8,6 +8,7 @@ Special thanks to external contributors on this release: * CLI/RPC/Config - [rpc] \#3113 rename n_txs to count in `/num_unconfirmed_txs` and `/unconfirmed_txs` + - [config] \#3079 rename `mempool.size` to `mempool.max_txs` * Apps diff --git a/config/config.go b/config/config.go index b6577c55f..e5c9abb1d 100644 --- a/config/config.go +++ b/config/config.go @@ -534,7 +534,7 @@ type MempoolConfig struct { Recheck bool `mapstructure:"recheck"` Broadcast bool `mapstructure:"broadcast"` WalPath string `mapstructure:"wal_dir"` - Size int `mapstructure:"size"` + MaxTxs int `mapstructure:"max_txs"` MaxTxsTotalBytes int64 `mapstructure:"max_txs_total_bytes"` CacheSize int `mapstructure:"cache_size"` } @@ -545,9 +545,9 @@ func DefaultMempoolConfig() *MempoolConfig { Recheck: true, Broadcast: true, WalPath: "", - // Each signature verification takes .5ms, Size reduced until we implement + // Each signature verification takes .5ms, MaxTxs reduced until we implement // ABCI Recheck - Size: 5000, + MaxTxs: 5000, MaxTxsTotalBytes: 1024 * 1024 * 1024, // 1GB CacheSize: 10000, } @@ -573,7 +573,7 @@ func (cfg *MempoolConfig) WalEnabled() bool { // ValidateBasic performs basic validation (checking param bounds, etc.) and // returns an error if any check fails. func (cfg *MempoolConfig) ValidateBasic() error { - if cfg.Size < 0 { + if cfg.MaxTxs < 0 { return errors.New("size can't be negative") } if cfg.MaxTxsTotalBytes < 0 { diff --git a/config/toml.go b/config/toml.go index e179f4e02..90e7603cd 100644 --- a/config/toml.go +++ b/config/toml.go @@ -235,7 +235,7 @@ broadcast = {{ .Mempool.Broadcast }} wal_dir = "{{ js .Mempool.WalPath }}" # Maximum number of transactions in the mempool -size = {{ .Mempool.Size }} +max_txs = {{ .Mempool.MaxTxs }} # Limit the total size of all txs in the mempool. # This only accounts for raw transactions (e.g. given 1MB transactions and diff --git a/docs/tendermint-core/configuration.md b/docs/tendermint-core/configuration.md index 6ed9ebec2..eda66b05a 100644 --- a/docs/tendermint-core/configuration.md +++ b/docs/tendermint-core/configuration.md @@ -184,7 +184,7 @@ broadcast = true wal_dir = "" # Maximum number of transactions in the mempool -size = 5000 +max_txs = 5000 # Limit the total size of all txs in the mempool. # This only accounts for raw transactions (e.g. given 1MB transactions and diff --git a/mempool/mempool.go b/mempool/mempool.go index 89b706174..fe4355256 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -334,10 +334,10 @@ func (mem *Mempool) CheckTx(tx types.Tx, cb func(*abci.Response)) (err error) { memSize = mem.Size() txsTotalBytes = mem.TxsTotalBytes() ) - if memSize >= mem.config.Size || + if memSize >= mem.config.MaxTxs || int64(len(tx))+txsTotalBytes > mem.config.MaxTxsTotalBytes { return ErrMempoolIsFull{ - memSize, mem.config.Size, + memSize, mem.config.MaxTxs, txsTotalBytes, mem.config.MaxTxsTotalBytes} }