Include Refund context in blinded payment paths
[rust-lightning] / lightning / src / blinded_path / payment.rs
index 99979ecf4a37140ef5f7375fdc2c0cc67e0eaa7b..ad7b229b53fa1c830d042d24a892360666bf5b65 100644 (file)
@@ -114,6 +114,11 @@ pub enum PaymentContext {
        ///
        /// [`Offer`]: crate::offers::offer::Offer
        Bolt12Offer(Bolt12OfferContext),
+
+       /// The payment was made for an invoice sent for a BOLT 12 [`Refund`].
+       ///
+       /// [`Refund`]: crate::offers::refund::Refund
+       Bolt12Refund(Bolt12RefundContext),
 }
 
 /// An unknown payment context.
@@ -131,6 +136,12 @@ pub struct Bolt12OfferContext {
        pub offer_id: OfferId,
 }
 
+/// The context of a payment made for an invoice sent for a BOLT 12 [`Refund`].
+///
+/// [`Refund`]: crate::offers::refund::Refund
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub struct Bolt12RefundContext {}
+
 impl PaymentContext {
        pub(crate) fn unknown() -> Self {
                PaymentContext::Unknown(UnknownPaymentContext(()))
@@ -358,6 +369,7 @@ impl_writeable_tlv_based_enum!(PaymentContext,
        ;
        (0, Unknown),
        (1, Bolt12Offer),
+       (2, Bolt12Refund),
 );
 
 impl Writeable for UnknownPaymentContext {
@@ -376,6 +388,8 @@ impl_writeable_tlv_based!(Bolt12OfferContext, {
        (0, offer_id, required),
 });
 
+impl_writeable_tlv_based!(Bolt12RefundContext, {});
+
 #[cfg(test)]
 mod tests {
        use bitcoin::secp256k1::PublicKey;