- let route_params = RouteParameters {
- payment_params: PaymentParameters::from_bolt12_invoice(&invoice),
- final_value_msat: invoice.amount_msats(),
- };
+ let mut payment_params = PaymentParameters::from_bolt12_invoice(&invoice);
+
+ // Advance any blinded path where the introduction node is our node.
+ if let Ok(our_node_id) = node_signer.get_node_id(Recipient::Node) {
+ for (_, path) in payment_params.payee.blinded_route_hints_mut().iter_mut() {
+ let introduction_node_id = match path.introduction_node {
+ IntroductionNode::NodeId(pubkey) => pubkey,
+ IntroductionNode::DirectedShortChannelId(direction, scid) => {
+ match node_id_lookup.next_node_id(scid) {
+ Some(next_node_id) => *direction.select_pubkey(&our_node_id, &next_node_id),
+ None => continue,
+ }
+ },
+ };
+ if introduction_node_id == our_node_id {
+ let _ = advance_path_by_one(path, node_signer, node_id_lookup, secp_ctx);
+ }
+ }
+ }
+
+ let amount_msat = invoice.amount_msats();
+ let mut route_params = RouteParameters::from_payment_params_and_value(
+ payment_params, amount_msat
+ );
+ if let Some(max_fee_msat) = max_total_routing_fee_msat {
+ route_params.max_total_routing_fee_msat = Some(max_fee_msat);
+ }