@@ -65,6 +65,13 @@ pub(crate) enum PendingOutboundPayment {
65
65
// used anywhere.
66
66
max_total_routing_fee_msat : Option < u64 > ,
67
67
} ,
68
+ StaticInvoiceReceived {
69
+ payment_hash : PaymentHash ,
70
+ keysend_preimage : PaymentPreimage ,
71
+ retry_strategy : Retry ,
72
+ payment_release_secret : [ u8 ; 32 ] ,
73
+ route_params : RouteParameters ,
74
+ } ,
68
75
Retryable {
69
76
retry_strategy : Option < Retry > ,
70
77
attempts : PaymentAttempts ,
@@ -182,6 +189,7 @@ impl PendingOutboundPayment {
182
189
PendingOutboundPayment :: Legacy { .. } => None ,
183
190
PendingOutboundPayment :: AwaitingInvoice { .. } => None ,
184
191
PendingOutboundPayment :: InvoiceReceived { payment_hash, .. } => Some ( * payment_hash) ,
192
+ PendingOutboundPayment :: StaticInvoiceReceived { payment_hash, .. } => Some ( * payment_hash) ,
185
193
PendingOutboundPayment :: Retryable { payment_hash, .. } => Some ( * payment_hash) ,
186
194
PendingOutboundPayment :: Fulfilled { payment_hash, .. } => * payment_hash,
187
195
PendingOutboundPayment :: Abandoned { payment_hash, .. } => Some ( * payment_hash) ,
@@ -196,7 +204,8 @@ impl PendingOutboundPayment {
196
204
PendingOutboundPayment :: Fulfilled { session_privs, .. } |
197
205
PendingOutboundPayment :: Abandoned { session_privs, .. } => session_privs,
198
206
PendingOutboundPayment :: AwaitingInvoice { .. } |
199
- PendingOutboundPayment :: InvoiceReceived { .. } => { debug_assert ! ( false ) ; return ; } ,
207
+ PendingOutboundPayment :: InvoiceReceived { .. } |
208
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => { debug_assert ! ( false ) ; return ; } ,
200
209
} ) ;
201
210
let payment_hash = self . payment_hash ( ) ;
202
211
* self = PendingOutboundPayment :: Fulfilled { session_privs, payment_hash, timer_ticks_without_htlcs : 0 } ;
@@ -230,7 +239,8 @@ impl PendingOutboundPayment {
230
239
session_privs. remove ( session_priv)
231
240
} ,
232
241
PendingOutboundPayment :: AwaitingInvoice { .. } |
233
- PendingOutboundPayment :: InvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
242
+ PendingOutboundPayment :: InvoiceReceived { .. } |
243
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
234
244
} ;
235
245
if remove_res {
236
246
if let PendingOutboundPayment :: Retryable {
@@ -259,7 +269,8 @@ impl PendingOutboundPayment {
259
269
session_privs. insert ( session_priv)
260
270
} ,
261
271
PendingOutboundPayment :: AwaitingInvoice { .. } |
262
- PendingOutboundPayment :: InvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
272
+ PendingOutboundPayment :: InvoiceReceived { .. } |
273
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => { debug_assert ! ( false ) ; false } ,
263
274
PendingOutboundPayment :: Fulfilled { .. } => false ,
264
275
PendingOutboundPayment :: Abandoned { .. } => false ,
265
276
} ;
@@ -292,6 +303,7 @@ impl PendingOutboundPayment {
292
303
} ,
293
304
PendingOutboundPayment :: AwaitingInvoice { .. } => 0 ,
294
305
PendingOutboundPayment :: InvoiceReceived { .. } => 0 ,
306
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => 0 ,
295
307
}
296
308
}
297
309
}
@@ -1195,6 +1207,11 @@ impl OutboundPayments {
1195
1207
debug_assert ! ( false ) ;
1196
1208
return
1197
1209
} ,
1210
+ PendingOutboundPayment :: StaticInvoiceReceived { .. } => {
1211
+ log_error ! ( logger, "Payment already initiating" ) ;
1212
+ debug_assert ! ( false ) ;
1213
+ return
1214
+ } ,
1198
1215
PendingOutboundPayment :: Fulfilled { .. } => {
1199
1216
log_error ! ( logger, "Payment already completed" ) ;
1200
1217
return
@@ -1985,6 +2002,15 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
1985
2002
( 2 , retry_strategy, required) ,
1986
2003
( 4 , max_total_routing_fee_msat, option) ,
1987
2004
} ,
2005
+ // Added in 0.0.125. Prior versions will drop these outbounds on downgrade, which is safe because
2006
+ // no HTLCs are in-flight.
2007
+ ( 9 , StaticInvoiceReceived ) => {
2008
+ ( 0 , payment_hash, required) ,
2009
+ ( 2 , keysend_preimage, required) ,
2010
+ ( 4 , retry_strategy, required) ,
2011
+ ( 6 , payment_release_secret, required) ,
2012
+ ( 8 , route_params, required) ,
2013
+ } ,
1988
2014
) ;
1989
2015
1990
2016
#[ cfg( test) ]
0 commit comments