Skip to content

Commit 7335eba

Browse files
chore(cli): include wallet-affecting tx count in periodic snapshot logs
1 parent d084afe commit 7335eba

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

dash-spv/src/main.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,20 @@ async fn run_client<S: dash_spv::storage::StorageManager + Send + Sync + 'static
411411
_ = tokio::time::sleep(snapshot_interval) => {
412412
// Log snapshot if interval has elapsed
413413
if last_snapshot.elapsed() >= snapshot_interval {
414-
let (tx_count, confirmed, unconfirmed, locked, total, derived_incoming) = {
414+
let (tx_count, wallet_affecting_tx_count, confirmed, unconfirmed, locked, total, derived_incoming) = {
415415
let mgr = wallet_for_logger.read().await;
416416
// Count transactions via network state for the selected network
417417
let txs = mgr
418418
.get_network_state(network_for_logger)
419419
.map(|ns| ns.transactions.len())
420420
.unwrap_or(0);
421421

422+
// Count wallet-affecting transactions from wallet transaction history
423+
let wallet_affecting = mgr
424+
.wallet_transaction_history(&wallet_id_for_logger)
425+
.map(|v| v.len())
426+
.unwrap_or(0);
427+
422428
// Read wallet balance from the managed wallet info
423429
let wb = mgr.get_wallet_balance(&wallet_id_for_logger).ok();
424430
let (c, u, l, t) = wb.map(|b| (b.confirmed, b.unconfirmed, b.locked, b.total)).unwrap_or((0, 0, 0, 0));
@@ -440,13 +446,14 @@ async fn run_client<S: dash_spv::storage::StorageManager + Send + Sync + 'static
440446
sum_incoming
441447
} else { 0 };
442448

443-
(txs, c, u, l, t, incoming_sum)
449+
(txs, wallet_affecting, c, u, l, t, incoming_sum)
444450
};
445451
tracing::info!(
446-
"Wallet tx summary: detected={} (blocks={} + mempool={}), balances: confirmed={} unconfirmed={} locked={} total={}, derived_incoming_total={} (approx)",
452+
"Wallet tx summary: detected={} (blocks={} + mempool={}), affecting_wallet={}, balances: confirmed={} unconfirmed={} locked={} total={}, derived_incoming_total={} (approx)",
447453
tx_count,
448454
total_detected_block_txs,
449455
total_detected_mempool_txs,
456+
wallet_affecting_tx_count,
450457
confirmed,
451458
unconfirmed,
452459
locked,

0 commit comments

Comments
 (0)