@@ -27,6 +27,7 @@ use crate::ln::features::ChannelTypeFeatures;
27
27
use crate :: ln:: msgs;
28
28
use crate :: ln:: types:: { ChannelId , PaymentPreimage , PaymentHash , PaymentSecret } ;
29
29
use crate :: offers:: invoice:: Bolt12Invoice ;
30
+ use crate :: offers:: invoice_request:: InvoiceRequest ;
30
31
use crate :: onion_message:: messenger:: Responder ;
31
32
use crate :: routing:: gossip:: NetworkUpdate ;
32
33
use crate :: routing:: router:: { BlindedTail , Path , RouteHop , RouteParameters } ;
@@ -820,6 +821,23 @@ pub enum Event {
820
821
/// Sockets for connecting to the node.
821
822
addresses : Vec < msgs:: SocketAddress > ,
822
823
} ,
824
+
825
+ /// Event triggered when manual handling is enabled, and an invoice request is received.
826
+ InvoiceRequestReceived {
827
+ /// The invoice request to pay.
828
+ invoice_request : InvoiceRequest ,
829
+ /// The context of the [`BlindedMessagePath`] used to send the invoice request.
830
+ ///
831
+ /// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath
832
+ context : Option < OffersContext > ,
833
+ /// A responder for replying with an [`InvoiceError`] if needed.
834
+ ///
835
+ /// `None` if the invoice wasn't sent with a reply path.
836
+ ///
837
+ /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError
838
+ responder : Option < Responder > ,
839
+ } ,
840
+
823
841
/// Indicates a [`Bolt12Invoice`] in response to an [`InvoiceRequest`] or a [`Refund`] was
824
842
/// received.
825
843
///
@@ -1740,6 +1758,14 @@ impl Writeable for Event {
1740
1758
( 8 , former_temporary_channel_id, required) ,
1741
1759
} ) ;
1742
1760
} ,
1761
+ & Event :: InvoiceRequestReceived { ref invoice_request, ref context, ref responder } => {
1762
+ 44u8 . write ( writer) ?;
1763
+ write_tlv_fields ! ( writer, {
1764
+ ( 0 , invoice_request, required) ,
1765
+ ( 2 , context, option) ,
1766
+ ( 4 , responder, option) ,
1767
+ } ) ;
1768
+ } ,
1743
1769
// Note that, going forward, all new events must only write data inside of
1744
1770
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
1745
1771
// data via `write_tlv_fields`.
@@ -2234,6 +2260,21 @@ impl MaybeReadable for Event {
2234
2260
former_temporary_channel_id : former_temporary_channel_id. 0 . unwrap ( ) ,
2235
2261
} ) )
2236
2262
} ,
2263
+ 44u8 => {
2264
+ let mut f = || {
2265
+ _init_and_read_len_prefixed_tlv_fields ! ( reader, {
2266
+ ( 0 , invoice_request, required) ,
2267
+ ( 2 , context, option) ,
2268
+ ( 4 , responder, option) ,
2269
+ } ) ;
2270
+ Ok ( Some ( Event :: InvoiceRequestReceived {
2271
+ invoice_request : invoice_request. 0 . unwrap ( ) ,
2272
+ context,
2273
+ responder,
2274
+ } ) )
2275
+ } ;
2276
+ f ( )
2277
+ } ,
2237
2278
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
2238
2279
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
2239
2280
// reads.
0 commit comments