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:
parent
83581e173a
commit
020fef4b31
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user