Browse Source

rename MaxBytes to MaxTxsTotalBytes

pull/3248/head
Anton Kaliaev 6 years ago
parent
commit
fe8726ecf3
No known key found for this signature in database GPG Key ID: 7B6881D965918214
5 changed files with 20 additions and 20 deletions
  1. +1
    -1
      CHANGELOG_PENDING.md
  2. +12
    -12
      config/config.go
  3. +3
    -3
      config/toml.go
  4. +3
    -3
      docs/tendermint-core/configuration.md
  5. +1
    -1
      mempool/mempool.go

+ 1
- 1
CHANGELOG_PENDING.md View File

@ -18,7 +18,7 @@ Special thanks to external contributors on this release:
* P2P Protocol
### FEATURES:
- [mempool] \#3079 bound mempool memory usage (`mempool.max_bytes` is set to 1GB by default; see config.toml)
- [mempool] \#3079 bound mempool memory usage (`mempool.max_txs_total_bytes` is set to 1GB by default; see config.toml)
### IMPROVEMENTS:
- [tools] add go-deadlock tool to help detect deadlocks


+ 12
- 12
config/config.go View File

@ -530,13 +530,13 @@ func DefaultFuzzConnConfig() *FuzzConnConfig {
// MempoolConfig defines the configuration options for the Tendermint mempool
type MempoolConfig struct {
RootDir string `mapstructure:"home"`
Recheck bool `mapstructure:"recheck"`
Broadcast bool `mapstructure:"broadcast"`
WalPath string `mapstructure:"wal_dir"`
Size int `mapstructure:"size"`
MaxBytes int64 `mapstructure:"max_bytes"`
CacheSize int `mapstructure:"cache_size"`
RootDir string `mapstructure:"home"`
Recheck bool `mapstructure:"recheck"`
Broadcast bool `mapstructure:"broadcast"`
WalPath string `mapstructure:"wal_dir"`
Size int `mapstructure:"size"`
MaxTxsTotalBytes int64 `mapstructure:"max_txs_total_bytes"`
CacheSize int `mapstructure:"cache_size"`
}
// DefaultMempoolConfig returns a default configuration for the Tendermint mempool
@ -547,9 +547,9 @@ func DefaultMempoolConfig() *MempoolConfig {
WalPath: "",
// Each signature verification takes .5ms, Size reduced until we implement
// ABCI Recheck
Size: 5000,
MaxBytes: 1024 * 1024 * 1024, // 1GB
CacheSize: 10000,
Size: 5000,
MaxTxsTotalBytes: 1024 * 1024 * 1024, // 1GB
CacheSize: 10000,
}
}
@ -576,8 +576,8 @@ func (cfg *MempoolConfig) ValidateBasic() error {
if cfg.Size < 0 {
return errors.New("size can't be negative")
}
if cfg.MaxBytes < 0 {
return errors.New("max_bytes can't be negative")
if cfg.MaxTxsTotalBytes < 0 {
return errors.New("max_txs_total_bytes can't be negative")
}
if cfg.CacheSize < 0 {
return errors.New("cache_size can't be negative")


+ 3
- 3
config/toml.go View File

@ -237,10 +237,10 @@ wal_dir = "{{ js .Mempool.WalPath }}"
# Maximum number of transactions in the mempool
size = {{ .Mempool.Size }}
# Maximum size of the mempool in bytes
# Limit the total size of all txs in the mempool.
# This only accounts for raw transactions (e.g. given 1MB transactions and
# max_bytes=5MB, mempool will only accept 5 transactions).
max_bytes = {{ .Mempool.MaxBytes }}
# max_txs_total_bytes=5MB, mempool will only accept 5 transactions).
max_txs_total_bytes = {{ .Mempool.MaxTxsTotalBytes }}
# Size of the cache (used to filter transactions we saw earlier) in transactions
cache_size = {{ .Mempool.CacheSize }}


+ 3
- 3
docs/tendermint-core/configuration.md View File

@ -186,10 +186,10 @@ wal_dir = ""
# Maximum number of transactions in the mempool
size = 5000
# Maximum size of the mempool in bytes
# Limit the total size of all txs in the mempool.
# This only accounts for raw transactions (e.g. given 1MB transactions and
# max_bytes=5MB, mempool will only accept 5 transactions).
max_bytes = 1073741824
# max_txs_total_bytes=5MB, mempool will only accept 5 transactions).
max_txs_total_bytes = 1073741824
# Size of the cache (used to filter transactions we saw earlier) in transactions
cache_size = 10000


+ 1
- 1
mempool/mempool.go View File

@ -319,7 +319,7 @@ func (mem *Mempool) CheckTx(tx types.Tx, cb func(*abci.Response)) (err error) {
if mem.Size() >= mem.config.Size {
return ErrMempoolIsFull
} else if int64(len(tx))+mem.TxsTotalBytes() > mem.config.MaxBytes {
} else if int64(len(tx))+mem.TxsTotalBytes() > mem.config.MaxTxsTotalBytes {
return ErrMempoolIsFull
}


Loading…
Cancel
Save