fix: send-to-self payments include change from outgoing only

An incoming transaction will not contain any send-to-self
payments.
This commit is contained in:
Michael Mallan 2025-01-02 15:47:10 +00:00
parent 83581e173a
commit 020fef4b31
No known key found for this signature in database
GPG Key ID: 5177CDCEDB0EABEB

View File

@ -388,6 +388,13 @@ impl HistoryTransaction {
)
}
pub fn is_outgoing(&self) -> bool {
matches!(
self.kind,
TransactionKind::OutgoingPaymentBatch(_) | TransactionKind::OutgoingSinglePayment(_)
)
}
pub fn is_send_to_self(&self) -> bool {
matches!(self.kind, TransactionKind::SendToSelf)
}
@ -492,7 +499,8 @@ pub fn payments_from_tx(history_tx: HistoryTransaction) -> Vec<Payment> {
time,
amount: output.value,
kind: if history_tx.is_send_to_self()
|| history_tx.change_indexes.contains(&output_index)
|| (history_tx.is_outgoing()
&& history_tx.change_indexes.contains(&output_index))
{
PaymentKind::SendToSelf
} else if history_tx.is_external() {