mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-19 14:24:47 -07:00
mempool: general improvements
This commit is contained in:
@@ -5,9 +5,7 @@ use std::{
|
||||
|
||||
use brk_error::{Error, Result};
|
||||
use brk_rpc::{Auth, Client};
|
||||
use brk_server::{
|
||||
CdnCacheMode, DEFAULT_CACHE_SIZE, DEFAULT_MAX_WEIGHT, DEFAULT_MAX_WEIGHT_LOCALHOST, Website,
|
||||
};
|
||||
use brk_server::{CdnCacheMode, DEFAULT_MAX_WEIGHT, Website};
|
||||
use brk_types::Port;
|
||||
use owo_colors::OwoColorize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -32,12 +30,6 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
maxweight: Option<usize>,
|
||||
|
||||
#[serde(default)]
|
||||
maxweightlocal: Option<usize>,
|
||||
|
||||
#[serde(default)]
|
||||
cachesize: Option<usize>,
|
||||
|
||||
#[serde(default)]
|
||||
bitcoindir: Option<String>,
|
||||
|
||||
@@ -87,12 +79,6 @@ impl Config {
|
||||
if let Some(v) = config_args.maxweight {
|
||||
config.maxweight = Some(v);
|
||||
}
|
||||
if let Some(v) = config_args.maxweightlocal {
|
||||
config.maxweightlocal = Some(v);
|
||||
}
|
||||
if let Some(v) = config_args.cachesize {
|
||||
config.cachesize = Some(v);
|
||||
}
|
||||
if let Some(v) = config_args.bitcoindir {
|
||||
config.bitcoindir = Some(v);
|
||||
}
|
||||
@@ -143,12 +129,6 @@ impl Config {
|
||||
Long("maxweight") => {
|
||||
config.maxweight = Some(parser.value().unwrap().parse().unwrap())
|
||||
}
|
||||
Long("maxweightlocal") => {
|
||||
config.maxweightlocal = Some(parser.value().unwrap().parse().unwrap())
|
||||
}
|
||||
Long("cachesize") => {
|
||||
config.cachesize = Some(parser.value().unwrap().parse().unwrap())
|
||||
}
|
||||
Long("bitcoindir") => {
|
||||
config.bitcoindir = Some(parser.value().unwrap().parse().unwrap())
|
||||
}
|
||||
@@ -214,20 +194,10 @@ impl Config {
|
||||
"[false]".bright_black()
|
||||
);
|
||||
println!(
|
||||
" --maxweight {} Max series response weight in bytes for external clients {}",
|
||||
" --maxweight {} Max series response weight in bytes {}",
|
||||
"<BYTES>".bright_black(),
|
||||
format!("[{}]", DEFAULT_MAX_WEIGHT).bright_black()
|
||||
);
|
||||
println!(
|
||||
" --maxweightlocal {} Max series response weight in bytes for loopback clients {}",
|
||||
"<BYTES>".bright_black(),
|
||||
format!("[{}]", DEFAULT_MAX_WEIGHT_LOCALHOST).bright_black()
|
||||
);
|
||||
println!(
|
||||
" --cachesize {} LRU capacity for the in-process response cache {}",
|
||||
"<ENTRIES>".bright_black(),
|
||||
format!("[{}]", DEFAULT_CACHE_SIZE).bright_black()
|
||||
);
|
||||
println!();
|
||||
println!(
|
||||
" --bitcoindir {} Bitcoin directory {}",
|
||||
@@ -410,14 +380,6 @@ Finally, you can run the program with '-h' for help."
|
||||
self.maxweight.unwrap_or(DEFAULT_MAX_WEIGHT)
|
||||
}
|
||||
|
||||
pub fn max_weight_localhost(&self) -> usize {
|
||||
self.maxweightlocal.unwrap_or(DEFAULT_MAX_WEIGHT_LOCALHOST)
|
||||
}
|
||||
|
||||
pub fn cache_size(&self) -> usize {
|
||||
self.cachesize.unwrap_or(DEFAULT_CACHE_SIZE)
|
||||
}
|
||||
|
||||
pub fn brkport(&self) -> Option<Port> {
|
||||
self.brkport
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ pub fn main() -> anyhow::Result<()> {
|
||||
website: config.website(),
|
||||
cdn_cache_mode: config.cdn_cache_mode(),
|
||||
max_weight: config.max_weight(),
|
||||
max_weight_localhost: config.max_weight_localhost(),
|
||||
cache_size: config.cache_size(),
|
||||
};
|
||||
|
||||
let port = config.brkport();
|
||||
|
||||
Reference in New Issue
Block a user