@@ -22,6 +22,7 @@ use crate::ln::channelmanager::{EventCompletionAction, HTLCSource, PaymentId};
22
22
use crate :: ln:: onion_utils;
23
23
use crate :: ln:: onion_utils:: { DecodedOnionFailure , HTLCFailReason } ;
24
24
use crate :: offers:: invoice:: Bolt12Invoice ;
25
+ use crate :: offers:: invoice_request:: InvoiceRequest ;
25
26
use crate :: routing:: router:: { BlindedTail , InFlightHtlcs , Path , PaymentParameters , Route , RouteParameters , Router } ;
26
27
use crate :: sign:: { EntropySource , NodeSigner , Recipient } ;
27
28
use crate :: util:: errors:: APIError ;
@@ -54,6 +55,7 @@ pub(crate) enum PendingOutboundPayment {
54
55
expiration : StaleExpiration ,
55
56
retry_strategy : Retry ,
56
57
max_total_routing_fee_msat : Option < u64 > ,
58
+ invoice_request : Option < InvoiceRequest > ,
57
59
} ,
58
60
InvoiceReceived {
59
61
payment_hash : PaymentHash ,
@@ -1351,7 +1353,7 @@ impl OutboundPayments {
1351
1353
1352
1354
pub ( super ) fn add_new_awaiting_invoice (
1353
1355
& self , payment_id : PaymentId , expiration : StaleExpiration , retry_strategy : Retry ,
1354
- max_total_routing_fee_msat : Option < u64 >
1356
+ max_total_routing_fee_msat : Option < u64 > , invoice_request : Option < InvoiceRequest >
1355
1357
) -> Result < ( ) , ( ) > {
1356
1358
let mut pending_outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
1357
1359
match pending_outbounds. entry ( payment_id) {
@@ -1361,6 +1363,7 @@ impl OutboundPayments {
1361
1363
expiration,
1362
1364
retry_strategy,
1363
1365
max_total_routing_fee_msat,
1366
+ invoice_request,
1364
1367
} ) ;
1365
1368
1366
1369
Ok ( ( ) )
@@ -1882,6 +1885,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
1882
1885
( 0 , expiration, required) ,
1883
1886
( 2 , retry_strategy, required) ,
1884
1887
( 4 , max_total_routing_fee_msat, option) ,
1888
+ ( 6 , invoice_request, option) ,
1885
1889
} ,
1886
1890
( 7 , InvoiceReceived ) => {
1887
1891
( 0 , payment_hash, required) ,
@@ -2120,7 +2124,7 @@ mod tests {
2120
2124
assert ! ( !outbound_payments. has_pending_payments( ) ) ;
2121
2125
assert ! (
2122
2126
outbound_payments. add_new_awaiting_invoice(
2123
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2127
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2124
2128
) . is_ok( )
2125
2129
) ;
2126
2130
assert ! ( outbound_payments. has_pending_payments( ) ) ;
@@ -2146,14 +2150,14 @@ mod tests {
2146
2150
2147
2151
assert ! (
2148
2152
outbound_payments. add_new_awaiting_invoice(
2149
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2153
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2150
2154
) . is_ok( )
2151
2155
) ;
2152
2156
assert ! ( outbound_payments. has_pending_payments( ) ) ;
2153
2157
2154
2158
assert ! (
2155
2159
outbound_payments. add_new_awaiting_invoice(
2156
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2160
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2157
2161
) . is_err( )
2158
2162
) ;
2159
2163
}
@@ -2169,7 +2173,7 @@ mod tests {
2169
2173
assert ! ( !outbound_payments. has_pending_payments( ) ) ;
2170
2174
assert ! (
2171
2175
outbound_payments. add_new_awaiting_invoice(
2172
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2176
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2173
2177
) . is_ok( )
2174
2178
) ;
2175
2179
assert ! ( outbound_payments. has_pending_payments( ) ) ;
@@ -2195,14 +2199,14 @@ mod tests {
2195
2199
2196
2200
assert ! (
2197
2201
outbound_payments. add_new_awaiting_invoice(
2198
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2202
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2199
2203
) . is_ok( )
2200
2204
) ;
2201
2205
assert ! ( outbound_payments. has_pending_payments( ) ) ;
2202
2206
2203
2207
assert ! (
2204
2208
outbound_payments. add_new_awaiting_invoice(
2205
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2209
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2206
2210
) . is_err( )
2207
2211
) ;
2208
2212
}
@@ -2217,7 +2221,7 @@ mod tests {
2217
2221
assert ! ( !outbound_payments. has_pending_payments( ) ) ;
2218
2222
assert ! (
2219
2223
outbound_payments. add_new_awaiting_invoice(
2220
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2224
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2221
2225
) . is_ok( )
2222
2226
) ;
2223
2227
assert ! ( outbound_payments. has_pending_payments( ) ) ;
@@ -2251,7 +2255,7 @@ mod tests {
2251
2255
2252
2256
assert ! (
2253
2257
outbound_payments. add_new_awaiting_invoice(
2254
- payment_id, expiration, Retry :: Attempts ( 0 ) , None
2258
+ payment_id, expiration, Retry :: Attempts ( 0 ) , None , None
2255
2259
) . is_ok( )
2256
2260
) ;
2257
2261
assert ! ( outbound_payments. has_pending_payments( ) ) ;
@@ -2315,7 +2319,7 @@ mod tests {
2315
2319
assert ! (
2316
2320
outbound_payments. add_new_awaiting_invoice(
2317
2321
payment_id, expiration, Retry :: Attempts ( 0 ) ,
2318
- Some ( invoice. amount_msats( ) / 100 + 50_000 )
2322
+ Some ( invoice. amount_msats( ) / 100 + 50_000 ) , None
2319
2323
) . is_ok( )
2320
2324
) ;
2321
2325
assert ! ( outbound_payments. has_pending_payments( ) ) ;
@@ -2415,7 +2419,7 @@ mod tests {
2415
2419
2416
2420
assert ! (
2417
2421
outbound_payments. add_new_awaiting_invoice(
2418
- payment_id, expiration, Retry :: Attempts ( 0 ) , Some ( 1234 )
2422
+ payment_id, expiration, Retry :: Attempts ( 0 ) , Some ( 1234 ) , None
2419
2423
) . is_ok( )
2420
2424
) ;
2421
2425
assert ! ( outbound_payments. has_pending_payments( ) ) ;
0 commit comments