Skip to content

Commit e08ec7b

Browse files
committed
rustfmt: Run on lightning/src/blinded_path/mod.rs
1 parent 5e84ab3 commit e08ec7b

File tree

1 file changed

+14
-16
lines changed
  • lightning/src/blinded_path

1 file changed

+14
-16
lines changed

lightning/src/blinded_path/mod.rs

+14-16
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
//! Creating blinded paths and related utilities live here.
1111
12-
pub mod payment;
1312
pub mod message;
13+
pub mod payment;
1414
pub(crate) mod utils;
1515

1616
use bitcoin::secp256k1::PublicKey;
@@ -90,7 +90,9 @@ impl NodeIdLookUp for EmptyNodeIdLookUp {
9090

9191
impl Deref for EmptyNodeIdLookUp {
9292
type Target = EmptyNodeIdLookUp;
93-
fn deref(&self) -> &Self { self }
93+
fn deref(&self) -> &Self {
94+
self
95+
}
9496
}
9597

9698
/// An encrypted payload and node id corresponding to a hop in a payment or onion message path, to
@@ -108,20 +110,18 @@ pub struct BlindedHop {
108110

109111
impl BlindedPath {
110112
pub(super) fn public_introduction_node_id<'a>(
111-
&self, network_graph: &'a ReadOnlyNetworkGraph
113+
&self, network_graph: &'a ReadOnlyNetworkGraph,
112114
) -> Option<&'a NodeId> {
113115
match &self.introduction_node {
114116
IntroductionNode::NodeId(pubkey) => {
115117
let node_id = NodeId::from_pubkey(pubkey);
116118
network_graph.nodes().get_key_value(&node_id).map(|(key, _)| key)
117119
},
118120
IntroductionNode::DirectedShortChannelId(direction, scid) => {
119-
network_graph
120-
.channel(*scid)
121-
.map(|c| match direction {
122-
Direction::NodeOne => &c.node_one,
123-
Direction::NodeTwo => &c.node_two,
124-
})
121+
network_graph.channel(*scid).map(|c| match direction {
122+
Direction::NodeOne => &c.node_one,
123+
Direction::NodeTwo => &c.node_two,
124+
})
125125
},
126126
}
127127
}
@@ -155,7 +155,7 @@ impl Readable for BlindedPath {
155155
let introduction_node = match first_byte {
156156
0 => IntroductionNode::DirectedShortChannelId(Direction::NodeOne, Readable::read(r)?),
157157
1 => IntroductionNode::DirectedShortChannelId(Direction::NodeTwo, Readable::read(r)?),
158-
2|3 => {
158+
2 | 3 => {
159159
let mut bytes = [0; 33];
160160
bytes[0] = first_byte;
161161
r.read_exact(&mut bytes[1..])?;
@@ -165,16 +165,14 @@ impl Readable for BlindedPath {
165165
};
166166
let blinding_point = Readable::read(r)?;
167167
let num_hops: u8 = Readable::read(r)?;
168-
if num_hops == 0 { return Err(DecodeError::InvalidValue) }
168+
if num_hops == 0 {
169+
return Err(DecodeError::InvalidValue);
170+
}
169171
let mut blinded_hops: Vec<BlindedHop> = Vec::with_capacity(num_hops.into());
170172
for _ in 0..num_hops {
171173
blinded_hops.push(Readable::read(r)?);
172174
}
173-
Ok(BlindedPath {
174-
introduction_node,
175-
blinding_point,
176-
blinded_hops,
177-
})
175+
Ok(BlindedPath { introduction_node, blinding_point, blinded_hops })
178176
}
179177
}
180178

0 commit comments

Comments
 (0)