@@ -872,7 +872,7 @@ impl OutboundPayments {
872
872
payment_params, amount_msat
873
873
) ;
874
874
onion_utils:: set_max_path_length (
875
- & mut route_params, & RecipientOnionFields :: spontaneous_empty ( ) , None , best_block_height
875
+ & mut route_params, & RecipientOnionFields :: spontaneous_empty ( ) , None , None , best_block_height
876
876
) . map_err ( |( ) | Bolt12PaymentError :: OnionPacketSizeExceeded ) ?;
877
877
878
878
if let Some ( max_fee_msat) = max_total_routing_fee_msat {
@@ -939,13 +939,19 @@ impl OutboundPayments {
939
939
{
940
940
let ( payment_hash, route_params) =
941
941
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
942
- hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
942
+ hash_map:: Entry :: Occupied ( mut entry) => match entry. get_mut ( ) {
943
943
PendingOutboundPayment :: StaticInvoiceReceived {
944
- payment_hash, payment_release_secret : release_secret, route_params, ..
944
+ payment_hash, keysend_preimage, payment_release_secret : release_secret, invoice_request,
945
+ ref mut route_params, ..
945
946
} => {
946
947
if payment_release_secret != * release_secret {
947
948
return Err ( Bolt12PaymentError :: UnexpectedInvoice )
948
949
}
950
+ onion_utils:: set_max_path_length (
951
+ route_params, & RecipientOnionFields :: spontaneous_empty ( ) ,
952
+ Some ( * keysend_preimage) , Some ( invoice_request) , best_block_height
953
+ ) . map_err ( |( ) | Bolt12PaymentError :: OnionPacketSizeExceeded ) ?;
954
+
949
955
( * payment_hash, route_params. clone ( ) )
950
956
} ,
951
957
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
@@ -1055,7 +1061,7 @@ impl OutboundPayments {
1055
1061
}
1056
1062
1057
1063
onion_utils:: set_max_path_length (
1058
- & mut route_params, & recipient_onion, keysend_preimage, best_block_height
1064
+ & mut route_params, & recipient_onion, keysend_preimage, None , best_block_height
1059
1065
)
1060
1066
. map_err ( |( ) | {
1061
1067
log_error ! ( logger, "Can't construct an onion packet without exceeding 1300-byte onion \
0 commit comments