Skip to content

Commit 50c850f

Browse files
Set update_add blinding point on HTLC forward
Used by the next hop to decode their blinded onion payload.
1 parent a2b2fb0 commit 50c850f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParame
5353
use crate::ln::onion_payment::{check_incoming_htlc_cltv, create_recv_pending_htlc_info, create_fwd_pending_htlc_info, decode_incoming_update_add_htlc_onion, InboundOnionErr, NextPacketDetails};
5454
use crate::ln::msgs;
5555
use crate::ln::onion_utils;
56-
use crate::ln::onion_utils::HTLCFailReason;
56+
use crate::ln::onion_utils::{HTLCFailReason, INVALID_ONION_BLINDING};
5757
use crate::ln::msgs::{ChannelMessageHandler, DecodeError, LightningError};
5858
#[cfg(test)]
5959
use crate::ln::outbound_payment;
@@ -4262,9 +4262,17 @@ where
42624262
phantom_shared_secret: None,
42634263
blinded_failure: blinded.map(|_| BlindedFailure::FromIntroductionNode),
42644264
});
4265+
let next_blinding_point = blinded.and_then(|b| {
4266+
let encrypted_tlvs_ss = self.node_signer.ecdh(
4267+
Recipient::Node, &b.inbound_blinding_point, None
4268+
).unwrap().secret_bytes();
4269+
onion_utils::next_hop_pubkey(
4270+
&self.secp_ctx, b.inbound_blinding_point, &encrypted_tlvs_ss
4271+
).ok()
4272+
});
42654273
if let Err(e) = chan.queue_add_htlc(outgoing_amt_msat,
42664274
payment_hash, outgoing_cltv_value, htlc_source.clone(),
4267-
onion_packet, skimmed_fee_msat, None, &self.fee_estimator,
4275+
onion_packet, skimmed_fee_msat, next_blinding_point, &self.fee_estimator,
42684276
&self.logger)
42694277
{
42704278
if let ChannelError::Ignore(msg) = e {

lightning/src/ln/onion_utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ pub(super) fn build_onion_payloads(path: &Path, total_msat: u64, mut recipient_o
242242
/// the hops can be of variable length.
243243
pub(crate) const ONION_DATA_LEN: usize = 20*65;
244244

245+
pub(super) const INVALID_ONION_BLINDING: u16 = 0x8000 | 0x4000 | 24;
246+
245247
#[inline]
246248
fn shift_slice_right(arr: &mut [u8], amt: usize) {
247249
for i in (amt..arr.len()).rev() {

0 commit comments

Comments
 (0)