Skip to content

Commit a52cbbc

Browse files
committed
f: formating
1 parent 216345e commit a52cbbc

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ use bitcoin::secp256k1::ecdh::SharedSecret;
3333
use bitcoin::secp256k1::{PublicKey, Scalar, Secp256k1, SecretKey};
3434

3535
use crate::io::{Cursor, Read};
36-
use core::ops::Deref;
3736
use crate::ln::msgs::InboundOnionPayload;
3837
#[allow(unused_imports)]
3938
use crate::prelude::*;
39+
use core::ops::Deref;
4040

4141
pub(crate) struct OnionKeys {
4242
#[cfg(test)]
@@ -1434,7 +1434,7 @@ pub(crate) enum Hop {
14341434
next_trampoline_hop_data: msgs::InboundTrampolineForwardPayload,
14351435
trampoline_shared_secret: SharedSecret,
14361436
next_trampoline_hop_hmac: [u8; 32],
1437-
new_trampoline_packet_bytes: Vec<u8>
1437+
new_trampoline_packet_bytes: Vec<u8>,
14381438
},
14391439
/// This onion payload needs to be forwarded to a next-hop.
14401440
BlindedForward {
@@ -1563,43 +1563,54 @@ where
15631563
Ok(Hop::BlindedReceive { shared_secret, hop_data })
15641564
},
15651565
msgs::InboundOnionPayload::TrampolineEntrypoint(hop_data) => {
1566-
let trampoline_shared_secret = node_signer.ecdh(
1567-
recipient, &hop_data.trampoline_packet.public_key, blinded_node_id_tweak.as_ref(),
1568-
).unwrap().secret_bytes();
1569-
let decoded_trampoline_hop: Result<(msgs::InboundOnionPayload, Option<([u8; 32], Vec<u8>)>), _> = decode_next_hop(
1566+
let trampoline_shared_secret = node_signer
1567+
.ecdh(
1568+
recipient,
1569+
&hop_data.trampoline_packet.public_key,
1570+
blinded_node_id_tweak.as_ref(),
1571+
)
1572+
.unwrap()
1573+
.secret_bytes();
1574+
let decoded_trampoline_hop: Result<
1575+
(msgs::InboundOnionPayload, Option<([u8; 32], Vec<u8>)>),
1576+
_,
1577+
> = decode_next_hop(
15701578
trampoline_shared_secret,
15711579
&hop_data.trampoline_packet.hop_data,
15721580
hop_data.trampoline_packet.hmac,
15731581
Some(payment_hash),
15741582
(blinding_point, node_signer),
15751583
);
15761584
match decoded_trampoline_hop {
1577-
Ok((next_trampoline_hop_data, Some((next_trampoline_hop_hmac, new_trampoline_packet_bytes)))) => {
1585+
Ok((
1586+
next_trampoline_hop_data,
1587+
Some((next_trampoline_hop_hmac, new_trampoline_packet_bytes)),
1588+
)) => {
15781589
match next_trampoline_hop_data {
15791590
InboundOnionPayload::TrampolineForward(trampoline_hop_data) => {
15801591
Ok(Hop::TrampolineForward {
15811592
outer_hop_data: hop_data,
15821593
outer_shared_secret: shared_secret,
15831594
next_trampoline_hop_data: trampoline_hop_data,
1584-
trampoline_shared_secret: SharedSecret::from_bytes(trampoline_shared_secret),
1595+
trampoline_shared_secret: SharedSecret::from_bytes(
1596+
trampoline_shared_secret,
1597+
),
15851598
next_trampoline_hop_hmac,
15861599
new_trampoline_packet_bytes,
15871600
})
1588-
}
1601+
},
15891602
_ => Err(OnionDecodeErr::Malformed {
15901603
err_msg: "Non-Trampoline onion data provided to us as inner onion",
15911604
// todo: find more suitable error code
15921605
err_code: 0x4000 | 22,
1593-
})
1606+
}),
15941607
}
1595-
}
1608+
},
15961609
Ok((_next_trampoline_hop_data, None)) => {
15971610
// this is a trampoline receive
15981611
todo!()
15991612
},
1600-
Err(e) => {
1601-
Err(e)
1602-
}
1613+
Err(e) => Err(e),
16031614
}
16041615
},
16051616
_ => {

0 commit comments

Comments
 (0)