config: rename mempool.size to mempool.max_txs

https://github.com/tendermint/tendermint/pull/3248#discussion_r254034004
This commit is contained in:
Anton Kaliaev
2019-02-06 10:21:05 +04:00
parent 8de0ffc965
commit 39bfa36961
5 changed files with 9 additions and 8 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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

View File

@@ -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}
}