mempool: make max_msg_bytes configurable (#3826)

* mempool: make max_msg_bytes configurable

* apply suggestions from code review

* update changelog pending

* apply suggestions from code review again
This commit is contained in:
Jun Kimura
2019-07-23 00:17:10 +09:00
committed by Jack Zampolin
parent 5ed39fd0b3
commit df6df61ea9
8 changed files with 41 additions and 13 deletions

View File

@ -631,6 +631,7 @@ type MempoolConfig struct {
Size int `mapstructure:"size"`
MaxTxsBytes int64 `mapstructure:"max_txs_bytes"`
CacheSize int `mapstructure:"cache_size"`
MaxMsgBytes int `mapstructure:"max_msg_bytes"`
}
// DefaultMempoolConfig returns a default configuration for the Tendermint mempool
@ -644,6 +645,7 @@ func DefaultMempoolConfig() *MempoolConfig {
Size: 5000,
MaxTxsBytes: 1024 * 1024 * 1024, // 1GB
CacheSize: 10000,
MaxMsgBytes: 1024 * 1024, // 1MB
}
}
@ -676,6 +678,9 @@ func (cfg *MempoolConfig) ValidateBasic() error {
if cfg.CacheSize < 0 {
return errors.New("cache_size can't be negative")
}
if cfg.MaxMsgBytes < 0 {
return errors.New("max_msg_bytes can't be negative")
}
return nil
}