From 41ac36f071937a81d49a5b02e6d331ee80c00ca4 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 1 Jun 2023 10:32:27 -0500 Subject: [PATCH] sort activity newest first and don't include unpaid invoices --- mutiny-core/src/nodemanager.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mutiny-core/src/nodemanager.rs b/mutiny-core/src/nodemanager.rs index 230654562..9c37d31ed 100644 --- a/mutiny-core/src/nodemanager.rs +++ b/mutiny-core/src/nodemanager.rs @@ -926,13 +926,18 @@ impl NodeManager { let onchain = self.list_onchain()?; let mut activity = Vec::with_capacity(lightning.len() + onchain.len()); for ln in lightning { - activity.push(ActivityItem::Lightning(Box::new(ln))); + // Only show paid invoices + if ln.paid { + activity.push(ActivityItem::Lightning(Box::new(ln))); + } } for on in onchain { activity.push(ActivityItem::OnChain(on)); } - activity.sort(); + // Newest first + activity.sort_by(|a, b| b.cmp(a)); + Ok(activity) }