Browse Source

config: rename mempool.size to mempool.max_txs

https://github.com/tendermint/tendermint/pull/3248#discussion_r254034004
pull/3248/head
Anton Kaliaev 5 years ago
parent
commit
39bfa36961
No known key found for this signature in database GPG Key ID: 7B6881D965918214
5 changed files with 9 additions and 8 deletions
  1. +1
    -0
      CHANGELOG_PENDING.md
  2. +4
    -4
      config/config.go
  3. +1
    -1
      config/toml.go
  4. +1
    -1
      docs/tendermint-core/configuration.md
  5. +2
    -2
      mempool/mempool.go

+ 1
- 0
CHANGELOG_PENDING.md 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


+ 4
- 4
config/config.go 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 {


+ 1
- 1
config/toml.go 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


+ 1
- 1
docs/tendermint-core/configuration.md 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


+ 2
- 2
mempool/mempool.go 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}
}


Loading…
Cancel
Save