Skip to content

Commit 25642c6

Browse files
committed
crypto: Fix warnings
1 parent b7325a2 commit 25642c6

File tree

4 files changed

+2
-63
lines changed

4 files changed

+2
-63
lines changed

src/crypto/noise.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -697,17 +697,6 @@ impl fmt::Debug for NoiseContext {
697697
}
698698

699699
impl NoiseContext {
700-
/// Create new [`NoiseContext`].
701-
pub fn new(id_keys: &Keypair) -> Self {
702-
let noise = snow::Builder::new(NOISE_PARAMETERS.parse().expect("valid Noise patterns"));
703-
let keypair = noise.generate_keypair().unwrap();
704-
705-
let noise =
706-
noise.local_private_key(&keypair.private).build_initiator().expect("to succeed");
707-
708-
NoiseContext::make_noise_and_payload(noise, keypair, id_keys)
709-
}
710-
711700
/// Create new [`NoiseContext`] with prologue.
712701
pub fn with_prologue(id_keys: &Keypair, prologue: Vec<u8>) -> Self {
713702
let noise = snow::Builder::new(NOISE_PARAMETERS.parse().expect("valid Noise patterns"));

src/crypto/tls/Cargo.toml

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/crypto/tls/upgrade.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ use super::certificate;
2424
pub enum UpgradeError {
2525
#[error("Failed to generate certificate")]
2626
CertificateGeneration(#[from] certificate::GenError),
27-
#[error("Failed to upgrade server connection")]
28-
ServerUpgrade(std::io::Error),
29-
#[error("Failed to upgrade client connection")]
30-
ClientUpgrade(std::io::Error),
3127
#[error("Failed to parse certificate")]
3228
BadCertificate(#[from] certificate::ParseError),
3329
}

src/protocol/notification/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,20 +281,17 @@ impl NotificationProtocol {
281281
"handle outbound substream",
282282
);
283283

284-
if self.pending_outbound.remove(&substream_id).is_none() {
285-
tracing::warn!(target: LOG_TARGET, ?peer, ?substream_id, "pending outbound substream doesn't exist");
286-
debug_assert!(false);
287-
}
288-
289284
// peer must exist since an outbound substream was received from them
290285
let context = self.peers.get_mut(&peer).expect("peer to exist");
286+
let pending_peer = self.pending_outbound.remove(&substream_id);
291287

292288
// the peer can be in two different states when an outbound substream has opened:
293289
// - `PeerState::OutboundInitiated` - local node opened an outbound substream
294290
// - `PeerState::Negotiating` - TODO
295291
match std::mem::replace(&mut context.state, PeerState::Poisoned) {
296292
PeerState::OutboundInitiated { substream } => {
297293
debug_assert!(substream == substream_id);
294+
debug_assert!(pending_peer == Some(peer));
298295

299296
self.negotiation.negotiate_outbound(peer, outbound);
300297
context.state = PeerState::Validating {

0 commit comments

Comments
 (0)