@@ -64,6 +64,13 @@ pub(crate) enum PendingOutboundPayment {
64
64
// used anywhere.
65
65
max_total_routing_fee_msat : Option < u64 > ,
66
66
} ,
67
+ StaticInvoiceReceived {
68
+ payment_hash : PaymentHash ,
69
+ keysend_preimage : PaymentPreimage ,
70
+ retry_strategy : Retry ,
71
+ payment_release_secret : [ u8 ; 32 ] ,
72
+ route_params : RouteParameters ,
73
+ } ,
67
74
Retryable {
68
75
retry_strategy : Option < Retry > ,
69
76
attempts : PaymentAttempts ,
@@ -170,6 +177,7 @@ impl PendingOutboundPayment {
170
177
PendingOutboundPayment :: Legacy { .. } => None ,
171
178
PendingOutboundPayment :: AwaitingInvoice { .. } => None ,
172
179
PendingOutboundPayment :: InvoiceReceived { payment_hash, .. } => Some ( * payment_hash) ,
180
+ PendingOutboundPayment :: StaticInvoiceReceived { payment_hash, .. } => Some ( * payment_hash) ,
173
181
PendingOutboundPayment :: Retryable { payment_hash, .. } => Some ( * payment_hash) ,
174
182
PendingOutboundPayment :: Fulfilled { payment_hash, .. } => * payment_hash,
175
183
PendingOutboundPayment :: Abandoned { payment_hash, .. } => Some ( * payment_hash) ,
@@ -184,7 +192,8 @@ impl PendingOutboundPayment {
184
192
PendingOutboundPayment :: Fulfilled { session_privs, .. } |
185
193
PendingOutboundPayment :: Abandoned { session_privs, .. } => session_privs,
186
194
PendingOutboundPayment :: AwaitingInvoice { .. } |
187
- PendingOutboundPayment :: InvoiceReceived { .. } => { debug_assert ! ( false ) ; return ; } ,
195
+ PendingOutboundPayment :: InvoiceReceived { .. } |
196
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => { debug_assert ! ( false ) ; return ; } ,
188
197
} ) ;
189
198
let payment_hash = self . payment_hash ( ) ;
190
199
* self = PendingOutboundPayment :: Fulfilled { session_privs, payment_hash, timer_ticks_without_htlcs : 0 } ;
@@ -218,7 +227,8 @@ impl PendingOutboundPayment {
218
227
session_privs. remove ( session_priv)
219
228
} ,
220
229
PendingOutboundPayment :: AwaitingInvoice { .. } |
221
- PendingOutboundPayment :: InvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
230
+ PendingOutboundPayment :: InvoiceReceived { .. } |
231
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
222
232
} ;
223
233
if remove_res {
224
234
if let PendingOutboundPayment :: Retryable {
@@ -247,7 +257,8 @@ impl PendingOutboundPayment {
247
257
session_privs. insert ( session_priv)
248
258
} ,
249
259
PendingOutboundPayment :: AwaitingInvoice { .. } |
250
- PendingOutboundPayment :: InvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
260
+ PendingOutboundPayment :: InvoiceReceived { .. } |
261
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
251
262
PendingOutboundPayment :: Fulfilled { .. } => false ,
252
263
PendingOutboundPayment :: Abandoned { .. } => false ,
253
264
} ;
@@ -280,6 +291,7 @@ impl PendingOutboundPayment {
280
291
} ,
281
292
PendingOutboundPayment :: AwaitingInvoice { .. } => 0 ,
282
293
PendingOutboundPayment :: InvoiceReceived { .. } => 0 ,
294
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => 0 ,
283
295
}
284
296
}
285
297
}
@@ -1121,6 +1133,7 @@ impl OutboundPayments {
1121
1133
* payment. into_mut ( ) = retryable_payment;
1122
1134
( total_amount, recipient_onion, None , onion_session_privs)
1123
1135
} ,
1136
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => todo ! ( ) ,
1124
1137
PendingOutboundPayment :: Fulfilled { .. } => {
1125
1138
log_error ! ( logger, "Payment already completed" ) ;
1126
1139
return
@@ -1892,6 +1905,13 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
1892
1905
( 2 , retry_strategy, required) ,
1893
1906
( 4 , max_total_routing_fee_msat, option) ,
1894
1907
} ,
1908
+ ( 9 , StaticInvoiceReceived ) => {
1909
+ ( 0 , payment_hash, required) ,
1910
+ ( 2 , keysend_preimage, required) ,
1911
+ ( 4 , retry_strategy, required) ,
1912
+ ( 6 , payment_release_secret, required) ,
1913
+ ( 8 , route_params, required) ,
1914
+ } ,
1895
1915
) ;
1896
1916
1897
1917
#[ cfg( test) ]
0 commit comments