Add PaymentPurpose::is_keysend utility method
[rust-lightning] / lightning / src / events / mod.rs
index d6553ae3aa22989f60b6508f7a17a97d990121ed..41ba17806d35b5c5bf31cdb51423775a7d8120cd 100644 (file)
@@ -83,6 +83,13 @@ impl PaymentPurpose {
                        PaymentPurpose::SpontaneousPayment(preimage) => Some(*preimage),
                }
        }
+
+       pub(crate) fn is_keysend(&self) -> bool {
+               match self {
+                       PaymentPurpose::Bolt11InvoicePayment { .. } => false,
+                       PaymentPurpose::SpontaneousPayment(..) => true,
+               }
+       }
 }
 
 impl_writeable_tlv_based_enum!(PaymentPurpose,