Do not include self transfer in home events

This commit is contained in:
edouardparis 2024-12-19 11:02:57 +01:00
parent 790beaa670
commit 79057a0cd9
2 changed files with 9 additions and 2 deletions

View File

@ -148,7 +148,11 @@ pub fn home_view<'a>(
.spacing(10)
.push(h4_bold("Last payments"))
.push(events.iter().fold(Column::new().spacing(10), |col, event| {
col.push(event_list_view(event))
if event.kind != PaymentKind::SendToSelf {
col.push(event_list_view(event))
} else {
col
}
}))
.push_maybe(if !is_last_page && !events.is_empty() {
Some(

View File

@ -423,6 +423,7 @@ pub struct Payment {
pub enum PaymentKind {
Outgoing,
Incoming,
SendToSelf,
}
impl Payment {
@ -488,7 +489,9 @@ pub fn payments_from_tx(history_tx: HistoryTransaction) -> Vec<Payment> {
outpoint,
time,
amount: output.value,
kind: if history_tx.is_external() {
kind: if history_tx.is_send_to_self() {
PaymentKind::SendToSelf
} else if history_tx.is_external() {
PaymentKind::Incoming
} else {
PaymentKind::Outgoing