From 55b92b3da707310900fca1570269c5e13b709d64 Mon Sep 17 00:00:00 2001 From: Michael Mallan Date: Tue, 31 Dec 2024 08:57:09 +0000 Subject: [PATCH] fix: treat change outputs as send-to-self payments --- liana-gui/src/daemon/model.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/liana-gui/src/daemon/model.rs b/liana-gui/src/daemon/model.rs index 1fc93f985..99c5fd021 100644 --- a/liana-gui/src/daemon/model.rs +++ b/liana-gui/src/daemon/model.rs @@ -423,6 +423,8 @@ pub struct Payment { pub enum PaymentKind { Outgoing, Incoming, + /// A payment to self, which could be either from a self-transfer + /// or a change output from an outgoing transaction. SendToSelf, } @@ -489,7 +491,9 @@ pub fn payments_from_tx(history_tx: HistoryTransaction) -> Vec { outpoint, time, amount: output.value, - kind: if history_tx.is_send_to_self() { + kind: if history_tx.is_send_to_self() + || history_tx.change_indexes.contains(&output_index) + { PaymentKind::SendToSelf } else if history_tx.is_external() { PaymentKind::Incoming