Skip to content

Commit ede62ba

Browse files
committed
f
1 parent 1725a3b commit ede62ba

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

lightning/src/blinded_path/utils.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,13 @@ where
138138
}
139139

140140
fn construct_keys_for_blinded_path<'a, T, I, F, H>(
141-
secp_ctx: &Secp256k1<T>, unblinded_path: I, session_priv: &SecretKey,
142-
mut callback: F,
141+
secp_ctx: &Secp256k1<T>, unblinded_path: I, session_priv: &SecretKey, mut callback: F,
143142
) -> Result<(), secp256k1::Error>
144143
where
145144
T: secp256k1::Signing + secp256k1::Verification,
146145
H: Borrow<PublicKey>,
147146
I: Iterator<Item = H>,
148-
F: FnMut(
149-
PublicKey,
150-
SharedSecret,
151-
PublicKey,
152-
[u8; 32],
153-
Option<H>,
154-
Option<Vec<u8>>,
155-
),
147+
F: FnMut(PublicKey, SharedSecret, PublicKey, [u8; 32], Option<H>, Option<Vec<u8>>),
156148
{
157149
build_keys_helper!(session_priv, secp_ctx, callback);
158150

@@ -186,8 +178,10 @@ where
186178
let mut blinded_hops = Vec::with_capacity(unblinded_path.size_hint().0);
187179
construct_keys_for_blinded_path(
188180
secp_ctx,
189-
unblinded_path.map(|((pubkey, hop_recv_key), tlvs)| {
190-
PublicKeyWithTlvs { pubkey, hop_recv_key, tlvs }
181+
unblinded_path.map(|((pubkey, hop_recv_key), tlvs)| PublicKeyWithTlvs {
182+
pubkey,
183+
hop_recv_key,
184+
tlvs,
191185
}),
192186
session_priv,
193187
|blinded_node_id, _, _, encrypted_payload_rho, unblinded_hop_data, _| {

lightning/src/onion_message/messenger.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,12 @@ fn packet_payloads_and_keys<
22982298

22992299
if let Some(control_tlvs) = final_control_tlvs {
23002300
payloads.push((
2301-
Payload::Receive { control_tlvs, reply_path: reply_path.take(), message, control_tlvs_authenticated: false, },
2301+
Payload::Receive {
2302+
control_tlvs,
2303+
reply_path: reply_path.take(),
2304+
message,
2305+
control_tlvs_authenticated: false,
2306+
},
23022307
prev_control_tlvs_ss.unwrap(),
23032308
));
23042309
} else {

lightning/src/onion_message/packet.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ pub(super) enum Payload<T: OnionMessageContents> {
116116
/// The [`ReceiveControlTlvs`] were authenticated with the additional key which was
117117
/// provided to [`ReadableArgs::read`].
118118
control_tlvs_authenticated: bool,
119-
control_tlvs: ReceiveControlTlvs, reply_path: Option<BlindedMessagePath>, message: T },
119+
control_tlvs: ReceiveControlTlvs,
120+
reply_path: Option<BlindedMessagePath>,
121+
message: T,
122+
},
120123
}
121124

122125
/// The contents of an [`OnionMessage`] as read from the wire.
@@ -258,10 +261,13 @@ impl<T: OnionMessageContents> Writeable for (Payload<T>, [u8; 32]) {
258261
}
259262

260263
// Uses the provided secret to simultaneously decode and decrypt the control TLVs and data TLV.
261-
impl<H: CustomOnionMessageHandler + ?Sized, L: Logger + ?Sized> ReadableArgs<(SharedSecret, &H, [u8; 32], &L)>
264+
impl<H: CustomOnionMessageHandler + ?Sized, L: Logger + ?Sized>
265+
ReadableArgs<(SharedSecret, &H, [u8; 32], &L)>
262266
for Payload<ParsedOnionMessageContents<<H as CustomOnionMessageHandler>::CustomMessage>>
263267
{
264-
fn read<R: Read>(r: &mut R, args: (SharedSecret, &H, [u8; 32], &L)) -> Result<Self, DecodeError> {
268+
fn read<R: Read>(
269+
r: &mut R, args: (SharedSecret, &H, [u8; 32], &L),
270+
) -> Result<Self, DecodeError> {
265271
let (encrypted_tlvs_ss, handler, receive_tlvs_key, logger) = args;
266272

267273
let v: BigSize = Readable::read(r)?;

0 commit comments

Comments
 (0)