Skip to content

Commit a2b2fb0

Browse files
Parameterize Channel's htlc forward method by outbound blinding point
Used in the next commit to set the update_add blinding point on HTLC forward.
1 parent 21ae9fd commit a2b2fb0

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

lightning/src/ln/channel.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,11 +3358,12 @@ impl<SP: Deref> Channel<SP> where
33583358
match &htlc_update {
33593359
&HTLCUpdateAwaitingACK::AddHTLC {
33603360
amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet,
3361-
skimmed_fee_msat, ..
3361+
skimmed_fee_msat, blinding_point, ..
33623362
} => {
3363-
match self.send_htlc(amount_msat, *payment_hash, cltv_expiry, source.clone(),
3364-
onion_routing_packet.clone(), false, skimmed_fee_msat, fee_estimator, logger)
3365-
{
3363+
match self.send_htlc(
3364+
amount_msat, *payment_hash, cltv_expiry, source.clone(), onion_routing_packet.clone(),
3365+
false, skimmed_fee_msat, blinding_point, fee_estimator, logger
3366+
) {
33663367
Ok(_) => update_add_count += 1,
33673368
Err(e) => {
33683369
match e {
@@ -4078,7 +4079,7 @@ impl<SP: Deref> Channel<SP> where
40784079
cltv_expiry: htlc.cltv_expiry,
40794080
onion_routing_packet: (**onion_packet).clone(),
40804081
skimmed_fee_msat: htlc.skimmed_fee_msat,
4081-
blinding_point: None,
4082+
blinding_point: htlc.blinding_point,
40824083
});
40834084
}
40844085
}
@@ -5507,13 +5508,13 @@ impl<SP: Deref> Channel<SP> where
55075508
pub fn queue_add_htlc<F: Deref, L: Deref>(
55085509
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32, source: HTLCSource,
55095510
onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5510-
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5511+
blinding_point: Option<PublicKey>, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
55115512
) -> Result<(), ChannelError>
55125513
where F::Target: FeeEstimator, L::Target: Logger
55135514
{
55145515
self
55155516
.send_htlc(amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true,
5516-
skimmed_fee_msat, fee_estimator, logger)
5517+
skimmed_fee_msat, blinding_point, fee_estimator, logger)
55175518
.map(|msg_opt| assert!(msg_opt.is_none(), "We forced holding cell?"))
55185519
.map_err(|err| {
55195520
if let ChannelError::Ignore(_) = err { /* fine */ }
@@ -5541,7 +5542,8 @@ impl<SP: Deref> Channel<SP> where
55415542
fn send_htlc<F: Deref, L: Deref>(
55425543
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32, source: HTLCSource,
55435544
onion_routing_packet: msgs::OnionPacket, mut force_holding_cell: bool,
5544-
skimmed_fee_msat: Option<u64>, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5545+
skimmed_fee_msat: Option<u64>, blinding_point: Option<PublicKey>,
5546+
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
55455547
) -> Result<Option<msgs::UpdateAddHTLC>, ChannelError>
55465548
where F::Target: FeeEstimator, L::Target: Logger
55475549
{
@@ -5598,7 +5600,7 @@ impl<SP: Deref> Channel<SP> where
55985600
source,
55995601
onion_routing_packet,
56005602
skimmed_fee_msat,
5601-
blinding_point: None,
5603+
blinding_point,
56025604
});
56035605
return Ok(None);
56045606
}
@@ -5610,7 +5612,7 @@ impl<SP: Deref> Channel<SP> where
56105612
cltv_expiry,
56115613
state: OutboundHTLCState::LocalAnnounced(Box::new(onion_routing_packet.clone())),
56125614
source,
5613-
blinding_point: None,
5615+
blinding_point,
56145616
skimmed_fee_msat,
56155617
});
56165618

@@ -5622,7 +5624,7 @@ impl<SP: Deref> Channel<SP> where
56225624
cltv_expiry,
56235625
onion_routing_packet,
56245626
skimmed_fee_msat,
5625-
blinding_point: None,
5627+
blinding_point,
56265628
};
56275629
self.context.next_holder_htlc_id += 1;
56285630

@@ -5785,7 +5787,7 @@ impl<SP: Deref> Channel<SP> where
57855787
where F::Target: FeeEstimator, L::Target: Logger
57865788
{
57875789
let send_res = self.send_htlc(amount_msat, payment_hash, cltv_expiry, source,
5788-
onion_routing_packet, false, skimmed_fee_msat, fee_estimator, logger);
5790+
onion_routing_packet, false, skimmed_fee_msat, None, fee_estimator, logger);
57895791
if let Err(e) = &send_res { if let ChannelError::Ignore(_) = e {} else { debug_assert!(false, "Sending cannot trigger channel failure"); } }
57905792
match send_res? {
57915793
Some(_) => {

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4264,7 +4264,7 @@ where
42644264
});
42654265
if let Err(e) = chan.queue_add_htlc(outgoing_amt_msat,
42664266
payment_hash, outgoing_cltv_value, htlc_source.clone(),
4267-
onion_packet, skimmed_fee_msat, &self.fee_estimator,
4267+
onion_packet, skimmed_fee_msat, None, &self.fee_estimator,
42684268
&self.logger)
42694269
{
42704270
if let ChannelError::Ignore(msg) = e {

0 commit comments

Comments
 (0)