mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-19 22:34:46 -07:00
mempool: cleanups
This commit is contained in:
@@ -4,31 +4,6 @@ use brk_error::Result;
|
||||
use brk_mempool::Mempool;
|
||||
use brk_rpc::{Auth, Client};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct MempoolStats {
|
||||
info_count: usize,
|
||||
tx_count: usize,
|
||||
unresolved_count: usize,
|
||||
addr_count: usize,
|
||||
outpoint_spend_count: usize,
|
||||
graveyard_tombstone_count: usize,
|
||||
graveyard_order_count: usize,
|
||||
}
|
||||
|
||||
impl From<&Mempool> for MempoolStats {
|
||||
fn from(mempool: &Mempool) -> Self {
|
||||
Self {
|
||||
info_count: mempool.info().count,
|
||||
tx_count: mempool.tx_count(),
|
||||
unresolved_count: mempool.unresolved_count(),
|
||||
addr_count: mempool.addr_count(),
|
||||
outpoint_spend_count: mempool.outpoint_spend_count(),
|
||||
graveyard_tombstone_count: mempool.graveyard_tombstone_count(),
|
||||
graveyard_order_count: mempool.graveyard_order_count(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
brk_logger::init(None)?;
|
||||
|
||||
@@ -48,9 +23,9 @@ fn main() -> Result<()> {
|
||||
loop {
|
||||
thread::sleep(Duration::from_secs(5));
|
||||
|
||||
let stats = MempoolStats::from(&mempool);
|
||||
let info_count = mempool.info().count;
|
||||
let stats = mempool.stats();
|
||||
let snapshot = mempool.snapshot();
|
||||
|
||||
let blocks_tx_total: usize = snapshot.blocks.iter().map(|b| b.len()).sum();
|
||||
|
||||
println!(
|
||||
@@ -58,18 +33,18 @@ fn main() -> Result<()> {
|
||||
graveyard.tombstones={} graveyard.order={} \
|
||||
snap.txs.len={} snap.blocks={} snap.blocks_txs={} \
|
||||
rebuilds={} skip.clean={}",
|
||||
stats.info_count,
|
||||
stats.tx_count,
|
||||
stats.unresolved_count,
|
||||
stats.addr_count,
|
||||
stats.outpoint_spend_count,
|
||||
stats.graveyard_tombstone_count,
|
||||
stats.graveyard_order_count,
|
||||
snapshot.txs_len(),
|
||||
info_count,
|
||||
stats.txs,
|
||||
stats.unresolved,
|
||||
stats.addrs,
|
||||
stats.outpoint_spends,
|
||||
stats.graveyard_tombstones,
|
||||
stats.graveyard_order,
|
||||
snapshot.txs.len(),
|
||||
snapshot.blocks.len(),
|
||||
blocks_tx_total,
|
||||
mempool.rebuild_count(),
|
||||
mempool.skip_clean_count(),
|
||||
stats.rebuilds,
|
||||
stats.skip_cleans,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user