Skip to content

Commit a049608

Browse files
committed
f rustfmt
1 parent e76aa50 commit a049608

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lightning/src/routing/gossip.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,25 +2561,27 @@ where
25612561
// that the provided point is on the curve. Thus, if we don't have a
25622562
// signature to verify, we want to skip the parsing step entirely.
25632563
// This represents a substantial speedup in applying RGS snapshots.
2564-
node_pubkey = Some(PublicKey::from_slice(node_id).map_err(|_| LightningError {
2565-
err: "Couldn't parse source node pubkey".to_owned(),
2566-
action: ErrorAction::IgnoreAndLog(Level::Debug),
2567-
})?);
2564+
node_pubkey =
2565+
Some(PublicKey::from_slice(node_id).map_err(|_| LightningError {
2566+
err: "Couldn't parse source node pubkey".to_owned(),
2567+
action: ErrorAction::IgnoreAndLog(Level::Debug),
2568+
})?);
25682569
}
25692570
},
25702571
}
25712572
}
25722573

25732574
if let Some(sig) = sig {
25742575
let msg_hash = hash_to_message!(&message_sha256d_hash(&msg)[..]);
2575-
if node_pubkey.is_none() {
2576+
let node_pubkey = if let Some(pubkey) = node_pubkey {
2577+
pubkey
2578+
} else {
25762579
debug_assert!(false, "node_pubkey should have been decoded above");
25772580
let err = "node_pubkey wasn't decoded but we need it to check a sig".to_owned();
2578-
return Err(LightningError {
2579-
err, action: ErrorAction::IgnoreAndLog(Level::Error),
2580-
});
2581-
}
2582-
secp_verify_sig!(self.secp_ctx, &msg_hash, &sig, &node_pubkey.unwrap(), "channel_update");
2581+
let action = ErrorAction::IgnoreAndLog(Level::Error);
2582+
return Err(LightningError { err, action });
2583+
};
2584+
secp_verify_sig!(self.secp_ctx, &msg_hash, &sig, &node_pubkey, "channel_update");
25832585
}
25842586

25852587
if only_verify {

0 commit comments

Comments
 (0)