Default values for pool config

Allows for deserializing config file without having to specify
all properties in it.
This commit is contained in:
Ignotus Peverell 2017-10-08 17:45:31 +00:00
parent 1e73e3aefc
commit 0d26daadc5
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
2 changed files with 9 additions and 2 deletions

View file

@ -99,6 +99,8 @@ pub struct ServerConfig {
/// Configuration for the mining daemon
pub mining_config: Option<pow::types::MinerConfig>,
/// Transaction pool configuration
#[serde(default)]
pub pool_config: pool::PoolConfig,
}

View file

@ -34,21 +34,26 @@ pub struct PoolConfig {
/// Base fee for a transaction to be accepted by the pool. The transaction
/// weight is computed from its number of inputs, outputs and kernels and
/// multipled by the base fee to compare to the actual transaction fee.
#[serde="default_accept_fee_base"]
pub accept_fee_base: u64,
/// Maximum capacity of the pool in number of transactions
#[serde="default_max_pool_size"]
pub max_pool_size: usize,
}
impl Default for PoolConfig {
fn default() -> PoolConfig {
PoolConfig {
accept_fee_base: 10,
max_pool_size: 50_000,
accept_fee_base: default_accept_fee_base(),
max_pool_size: default_max_pool_size(),
}
}
}
fn default_accept_fee_base() -> u64 { 10 }
fn default_max_pool_size() -> usize { 50_000 }
/// Placeholder: the data representing where we heard about a tx from.
///
/// Used to make decisions based on transaction acceptance priority from