Merge #1507: fix: treat change outputs as send-to-self payments
55b92b3da707310900fca1570269c5e13b709d64 fix: treat change outputs as send-to-self payments (Michael Mallan) Pull request description: This is a follow-up to #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 55b92b3da707310900fca1570269c5e13b709d64 Tree-SHA512: 347045e45a75632024e2539fedc7ab3f76b25fa14aeeac2490e5def7a746cf37097e636110e52823af84744f0970a07c70300fd324b62703f8d4cbd1be76ae7a
This commit is contained in:
commit
d28dd76ceb
@ -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<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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user