@@ -95,6 +95,8 @@ pub(crate) enum PendingOutboundPayment {
95
95
retry_strategy : Retry ,
96
96
route_params : RouteParameters ,
97
97
invoice_request : InvoiceRequest ,
98
+ // FIXME: we should pass the invoice as a string
99
+ static_invoice : String ,
98
100
} ,
99
101
Retryable {
100
102
retry_strategy : Option < Retry > ,
@@ -989,12 +991,19 @@ impl OutboundPayments {
989
991
* entry. into_mut ( ) = retryable_payment;
990
992
onion_session_privs
991
993
} ,
992
- PendingOutboundPayment :: StaticInvoiceReceived { .. } => {
994
+ PendingOutboundPayment :: StaticInvoiceReceived { static_invoice : _static_invoice , .. } => {
993
995
let invreq = if let PendingOutboundPayment :: StaticInvoiceReceived { invoice_request, .. } = entry. remove ( ) {
994
996
invoice_request
995
997
} else { unreachable ! ( ) } ;
998
+
999
+ #[ cfg( not( async_payments) ) ]
1000
+ let invoice: Option < OfferInvoice > = None ;
1001
+ #[ cfg( async_payments) ]
1002
+ let invoice = {
1003
+ None
1004
+ } ;
996
1005
let ( retryable_payment, onion_session_privs) = Self :: create_pending_payment (
997
- payment_hash, recipient_onion. clone ( ) , keysend_preimage, Some ( invreq) , bolt12_invoice . cloned ( ) , & route,
1006
+ payment_hash, recipient_onion. clone ( ) , keysend_preimage, Some ( invreq) , invoice , & route,
998
1007
Some ( retry_strategy) , payment_params, entropy_source, best_block_height
999
1008
) ;
1000
1009
outbounds. insert ( payment_id, retryable_payment) ;
@@ -1092,6 +1101,7 @@ impl OutboundPayments {
1092
1101
return Err ( Bolt12PaymentError :: SendingFailed ( RetryableSendFailure :: OnionPacketSizeExceeded ) )
1093
1102
}
1094
1103
1104
+ // Adds the static invoice here?
1095
1105
* entry. into_mut ( ) = PendingOutboundPayment :: StaticInvoiceReceived {
1096
1106
payment_hash,
1097
1107
keysend_preimage,
@@ -1102,6 +1112,7 @@ impl OutboundPayments {
1102
1112
. take ( )
1103
1113
. ok_or ( Bolt12PaymentError :: UnexpectedInvoice ) ?
1104
1114
. invoice_request ,
1115
+ static_invoice : String :: from ( "we should have the static invoice here" ) ,
1105
1116
} ;
1106
1117
return Ok ( ( ) )
1107
1118
} ,
@@ -2469,6 +2480,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
2469
2480
( 4 , retry_strategy, required) ,
2470
2481
( 6 , route_params, required) ,
2471
2482
( 8 , invoice_request, required) ,
2483
+ ( 10 , static_invoice, required) ,
2472
2484
} ,
2473
2485
// Added in 0.1. Prior versions will drop these outbounds on downgrade, which is safe because
2474
2486
// no HTLCs are in-flight.
0 commit comments