Skip to content

Commit 7aac741

Browse files
Parse blinding point in UpdateAddHTLC
1 parent 4777c29 commit 7aac741

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

lightning/src/ln/channel.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,6 +3802,7 @@ impl<SP: Deref> Channel<SP> where
38023802
cltv_expiry: htlc.cltv_expiry,
38033803
onion_routing_packet: (**onion_packet).clone(),
38043804
skimmed_fee_msat: htlc.skimmed_fee_msat,
3805+
blinding_point: None,
38053806
});
38063807
}
38073808
}
@@ -5260,6 +5261,7 @@ impl<SP: Deref> Channel<SP> where
52605261
cltv_expiry,
52615262
onion_routing_packet,
52625263
skimmed_fee_msat,
5264+
blinding_point: None,
52635265
};
52645266
self.context.next_holder_htlc_id += 1;
52655267

lightning/src/ln/functional_tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,7 @@ fn test_fee_spike_violation_fails_htlc() {
13971397
cltv_expiry: htlc_cltv,
13981398
onion_routing_packet: onion_packet,
13991399
skimmed_fee_msat: None,
1400+
blinding_point: None,
14001401
};
14011402

14021403
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &msg);
@@ -1587,6 +1588,7 @@ fn test_chan_reserve_violation_inbound_htlc_outbound_channel() {
15871588
cltv_expiry: htlc_cltv,
15881589
onion_routing_packet: onion_packet,
15891590
skimmed_fee_msat: None,
1591+
blinding_point: None,
15901592
};
15911593

15921594
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &msg);
@@ -1765,6 +1767,7 @@ fn test_chan_reserve_violation_inbound_htlc_inbound_chan() {
17651767
cltv_expiry: htlc_cltv,
17661768
onion_routing_packet: onion_packet,
17671769
skimmed_fee_msat: None,
1770+
blinding_point: None,
17681771
};
17691772

17701773
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &msg);
@@ -3486,6 +3489,7 @@ fn fail_backward_pending_htlc_upon_channel_failure() {
34863489
cltv_expiry,
34873490
onion_routing_packet,
34883491
skimmed_fee_msat: None,
3492+
blinding_point: None,
34893493
};
34903494
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &update_add_htlc);
34913495
}
@@ -6366,6 +6370,7 @@ fn test_update_add_htlc_bolt2_receiver_check_max_htlc_limit() {
63666370
cltv_expiry: htlc_cltv,
63676371
onion_routing_packet: onion_packet.clone(),
63686372
skimmed_fee_msat: None,
6373+
blinding_point: None,
63696374
};
63706375

63716376
for i in 0..50 {

lightning/src/ln/msgs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@ pub struct UpdateAddHTLC {
615615
/// [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
616616
pub skimmed_fee_msat: Option<u64>,
617617
pub(crate) onion_routing_packet: OnionPacket,
618+
/// Provided if we are relaying a payment within a blinded path, to decrypt the onion routing
619+
/// packet and the recipient-provided encrypted payload within.
620+
pub blinding_point: Option<PublicKey>,
618621
}
619622

620623
/// An onion message to be sent to or received from a peer.
@@ -1928,6 +1931,7 @@ impl_writeable_msg!(UpdateAddHTLC, {
19281931
cltv_expiry,
19291932
onion_routing_packet,
19301933
}, {
1934+
(0, blinding_point, option),
19311935
(65537, skimmed_fee_msat, option)
19321936
});
19331937

@@ -3373,6 +3377,7 @@ mod tests {
33733377
cltv_expiry: 821716,
33743378
onion_routing_packet,
33753379
skimmed_fee_msat: None,
3380+
blinding_point: None,
33763381
};
33773382
let encoded_value = update_add_htlc.encode();
33783383
let target_value = hex::decode("020202020202020202020202020202020202020202020202020202020202020200083a840000034d32144668701144760101010101010101010101010101010101010101010101010101010101010101000c89d4ff031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010202020202020202020202020202020202020202020202020202020202020202").unwrap();

0 commit comments

Comments
 (0)