Skip to content

Commit

Permalink
Compile fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ii-cruz committed Nov 25, 2024
1 parent 4d66caa commit 601b452
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dht/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl DhtVerifier for Verifier {
}

self.verify_validator_record(&validator_record)
.map_err(DhtVerifierError::ValidatorInfoError)
.map_err(|_| DhtVerifierError::ValidatorInfoError)
.and_then(|_| {
Ok(DhtRecord::Validator(
validator_record.record.peer_id,
Expand Down
4 changes: 3 additions & 1 deletion network-libp2p/src/dht.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use nimiq_serde::DeserializeError;
use nimiq_validator_network::validator_record::ValidatorRecord;

pub use crate::network_types::DhtRecord;
use crate::{discovery::peer_contacts::ValidatorInfoError, Network};
use crate::Network;

#[derive(Debug)]
pub enum DhtVerifierError {
Expand All @@ -22,6 +22,8 @@ pub enum DhtVerifierError {
),
StateIncomplete,
InvalidSignature,
ValidatorInfoError,
MissingPublisher,
}

pub trait Verifier: Send + Sync {
Expand Down
12 changes: 4 additions & 8 deletions network-libp2p/src/discovery/peer_contacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,13 @@ pub struct PeerContact {
#[serde(with = "self::serde_public_key")]
pub public_key: PublicKey,

/// Optional validator info in case the node is a validator.
pub validator_info: Option<ValidatorInfo>,

/// Services supported by this peer.
pub services: Services,

/// Optional [ValidatorInfo] in case the node represented by this contact is
/// running a validator.
validator_info: Option<ValidatorInfo>,

/// Services supported by this peer.
pub services: Services,

/// Timestamp when this peer contact was created in *seconds* since unix epoch.
timestamp: u64,
}
Expand All @@ -165,7 +162,6 @@ impl PeerContact {
public_key,
validator_info: None,
services,
validator_info: None,
timestamp,
})
}
Expand Down Expand Up @@ -291,7 +287,7 @@ impl SignedPeerContact {
&self,
#[cfg(feature = "kad")] verifier: Arc<dyn ValidatorRecordVerifier>,
) -> Result<(), PeerContactError> {
// The record signature must be verifid first.
// The record signature must be verified first.
if !self
.signature
.tagged_verify(&self.inner, &self.inner.public_key)
Expand Down
2 changes: 1 addition & 1 deletion network-libp2p/tests/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl dht::Verifier for Verifier {
record.clone(),
)
})
.map_err(dht::DhtVerifierError::ValidatorInfoError)
.map_err(|_| dht::DhtVerifierError::ValidatorInfoError)
}
}

Expand Down

0 comments on commit 601b452

Please sign in to comment.