@@ -94,6 +94,7 @@ pub(crate) enum PendingOutboundPayment {
94
94
payment_secret : Option < PaymentSecret > ,
95
95
payment_metadata : Option < Vec < u8 > > ,
96
96
keysend_preimage : Option < PaymentPreimage > ,
97
+ invoice_request : Option < InvoiceRequest > ,
97
98
custom_tlvs : Vec < ( u64 , Vec < u8 > ) > ,
98
99
pending_amt_msat : u64 ,
99
100
/// Used to track the fee paid. Present iff the payment was serialized on 0.0.103+.
@@ -946,18 +947,25 @@ impl OutboundPayments {
946
947
} ;
947
948
948
949
let payment_params = Some ( route_params. payment_params . clone ( ) ) ;
949
- let ( retryable_payment, onion_session_privs) = self . create_pending_payment (
950
- payment_hash, recipient_onion. clone ( ) , keysend_preimage, & route, Some ( retry_strategy) ,
951
- payment_params, entropy_source, best_block_height
952
- ) ;
950
+ let onion_session_privs;
953
951
let mut invoice_request_opt = None ;
954
952
let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
955
953
match outbounds. entry ( payment_id) {
956
954
hash_map:: Entry :: Occupied ( entry) => match entry. remove ( ) {
957
955
PendingOutboundPayment :: InvoiceReceived { .. } => {
956
+ let ( retryable_payment, session_privs) = self . create_pending_payment (
957
+ payment_hash, recipient_onion. clone ( ) , None , None , & route, Some ( retry_strategy) ,
958
+ payment_params, entropy_source, best_block_height
959
+ ) ;
960
+ onion_session_privs = session_privs;
958
961
outbounds. insert ( payment_id, retryable_payment) ;
959
962
} ,
960
963
PendingOutboundPayment :: StaticInvoiceReceived { invoice_request, .. } => {
964
+ let ( retryable_payment, session_privs) = self . create_pending_payment (
965
+ payment_hash, recipient_onion. clone ( ) , keysend_preimage, Some ( invoice_request. clone ( ) ) ,
966
+ & route, Some ( retry_strategy) , payment_params, entropy_source, best_block_height
967
+ ) ;
968
+ onion_session_privs = session_privs;
961
969
invoice_request_opt = Some ( invoice_request) ;
962
970
outbounds. insert ( payment_id, retryable_payment) ;
963
971
} ,
@@ -1560,7 +1568,7 @@ impl OutboundPayments {
1560
1568
hash_map:: Entry :: Occupied ( _) => Err ( PaymentSendFailure :: DuplicatePayment ) ,
1561
1569
hash_map:: Entry :: Vacant ( entry) => {
1562
1570
let ( payment, onion_session_privs) = self . create_pending_payment (
1563
- payment_hash, recipient_onion, keysend_preimage, route, retry_strategy,
1571
+ payment_hash, recipient_onion, keysend_preimage, None , route, retry_strategy,
1564
1572
payment_params, entropy_source, best_block_height
1565
1573
) ;
1566
1574
entry. insert ( payment) ;
@@ -1571,8 +1579,9 @@ impl OutboundPayments {
1571
1579
1572
1580
fn create_pending_payment < ES : Deref > (
1573
1581
& self , payment_hash : PaymentHash , recipient_onion : RecipientOnionFields ,
1574
- keysend_preimage : Option < PaymentPreimage > , route : & Route , retry_strategy : Option < Retry > ,
1575
- payment_params : Option < PaymentParameters > , entropy_source : & ES , best_block_height : u32
1582
+ keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < InvoiceRequest > ,
1583
+ route : & Route , retry_strategy : Option < Retry > , payment_params : Option < PaymentParameters > ,
1584
+ entropy_source : & ES , best_block_height : u32
1576
1585
) -> ( PendingOutboundPayment , Vec < [ u8 ; 32 ] > )
1577
1586
where
1578
1587
ES :: Target : EntropySource ,
@@ -1593,6 +1602,7 @@ impl OutboundPayments {
1593
1602
payment_secret : recipient_onion. payment_secret ,
1594
1603
payment_metadata : recipient_onion. payment_metadata ,
1595
1604
keysend_preimage,
1605
+ invoice_request,
1596
1606
custom_tlvs : recipient_onion. custom_tlvs ,
1597
1607
starting_block_height : best_block_height,
1598
1608
total_msat : route. get_total_amount ( ) ,
@@ -2178,6 +2188,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
2178
2188
( 9 , custom_tlvs, optional_vec) ,
2179
2189
( 10 , starting_block_height, required) ,
2180
2190
( 11 , remaining_max_total_routing_fee_msat, option) ,
2191
+ ( 13 , invoice_request, option) ,
2181
2192
( not_written, retry_strategy, ( static_value, None ) ) ,
2182
2193
( not_written, attempts, ( static_value, PaymentAttempts :: new( ) ) ) ,
2183
2194
} ,
0 commit comments