Skip to content

Commit

Permalink
Merge wizardsardine#1507: fix: treat change outputs as send-to-self p…
Browse files Browse the repository at this point in the history
…ayments

55b92b3 fix: treat change outputs as send-to-self payments (Michael Mallan)

Pull request description:

  This is a follow-up to wizardsardine#1503 to fix an issue with change outputs appearing as outgoing payments on the home page.

  It expands the definition of `PaymentKind::SendToSelf` to include change outputs since these are also payments to self.

ACKs for top commit:
  edouardparis:
    utACK 55b92b3

Tree-SHA512: 347045e45a75632024e2539fedc7ab3f76b25fa14aeeac2490e5def7a746cf37097e636110e52823af84744f0970a07c70300fd324b62703f8d4cbd1be76ae7a
  • Loading branch information
edouardparis committed Jan 2, 2025
2 parents 86e64ab + 55b92b3 commit d28dd76
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion liana-gui/src/daemon/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -489,7 +491,9 @@ pub fn payments_from_tx(history_tx: HistoryTransaction) -> Vec<Payment> {
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
Expand Down

0 comments on commit d28dd76

Please sign in to comment.