X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Frouter.rs;h=f7ed173b901a90a9dbe0d81166dfb188b77ccec9;hb=10125269d22c719107de062d4bbc47601d448d85;hp=e9c2988d4a7d4faecbc0451291c34d33ae8ef6c0;hpb=7a78998552b1d3c2d97f337a7d5aaf7fe1aa70b4;p=rust-lightning diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index e9c2988d..f7ed173b 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -621,8 +621,17 @@ impl PaymentParameters { /// /// The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has /// provided. - pub fn for_keysend(payee_pubkey: PublicKey, final_cltv_expiry_delta: u32) -> Self { - Self::from_node_id(payee_pubkey, final_cltv_expiry_delta).with_bolt11_features(InvoiceFeatures::for_keysend()).expect("PaymentParameters::from_node_id should always initialize the payee as unblinded") + /// + /// Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose + /// whether your router will be allowed to find a multi-part route for this payment. If you + /// set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via + /// [`RecipientOnionFields::secret_only`]. + /// + /// [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only + pub fn for_keysend(payee_pubkey: PublicKey, final_cltv_expiry_delta: u32, allow_mpp: bool) -> Self { + Self::from_node_id(payee_pubkey, final_cltv_expiry_delta) + .with_bolt11_features(InvoiceFeatures::for_keysend(allow_mpp)) + .expect("PaymentParameters::from_node_id should always initialize the payee as unblinded") } /// Includes the payee's features. Errors if the parameters were initialized with blinded payment @@ -929,7 +938,7 @@ impl<'a> CandidateRouteHop<'a> { fn htlc_minimum_msat(&self) -> u64 { match self { - CandidateRouteHop::FirstHop { .. } => 0, + CandidateRouteHop::FirstHop { details } => details.next_outbound_htlc_minimum_msat, CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat, CandidateRouteHop::PrivateHop { hint } => hint.htlc_minimum_msat.unwrap_or(0), } @@ -2492,6 +2501,7 @@ mod tests { balance_msat: 0, outbound_capacity_msat, next_outbound_htlc_limit_msat: outbound_capacity_msat, + next_outbound_htlc_minimum_msat: 0, inbound_capacity_msat: 42, unspendable_punishment_reserve: None, confirmations_required: None, @@ -6274,6 +6284,7 @@ pub(crate) mod bench_utils { user_channel_id: 0, balance_msat: 10_000_000_000, outbound_capacity_msat: 10_000_000_000, + next_outbound_htlc_minimum_msat: 0, next_outbound_htlc_limit_msat: 10_000_000_000, inbound_capacity_msat: 0, unspendable_punishment_reserve: None,