Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum Error {
/// The secret key does not match the provided ENR.
InvalidSecretKey,
/// An invalid signature was received for a challenge.
InvalidChallengeSignature(Challenge),
InvalidChallengeSignature(Box<Challenge>),
/// The Service channel has been closed early.
ServiceChannelClosed,
/// The discv5 service is not running.
Expand Down
6 changes: 3 additions & 3 deletions src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,10 @@ impl Handler {
&& match node_address.socket_addr {
SocketAddr::V4(socket_addr) => enr
.udp4_socket()
.map_or(true, |advertized_addr| socket_addr == advertized_addr),
.is_none_or(|advertized_addr| socket_addr == advertized_addr),
SocketAddr::V6(socket_addr) => enr
.udp6_socket()
.map_or(true, |advertized_addr| socket_addr == advertized_addr),
.is_none_or(|advertized_addr| socket_addr == advertized_addr),
}
}

Expand Down Expand Up @@ -893,7 +893,7 @@ impl Handler {
"Authentication header contained invalid signature. Ignoring packet from node",
);
// insert back the challenge
self.active_challenges.insert(node_address, challenge);
self.active_challenges.insert(node_address, *challenge);
}
Err(e) => {
warn!(
Expand Down
2 changes: 1 addition & 1 deletion src/handler/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl Session {
local_id,
id_nonce_sig,
) {
return Err(Error::InvalidChallengeSignature(challenge));
return Err(Error::InvalidChallengeSignature(Box::new(challenge)));
}

// The keys are derived after the message has been verified to prevent potential extra work
Expand Down
14 changes: 6 additions & 8 deletions src/kbucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,16 @@ where
let update_value = bucket.update_value(key, value);

match (update_value, update_status) {
(UpdateResult::Updated { .. }, UpdateResult::Updated) => {
InsertResult::Updated {
promoted_to_connected: false,
}
}
(UpdateResult::Updated { .. }, UpdateResult::UpdatedAndPromoted) => {
(UpdateResult::Updated, UpdateResult::Updated) => InsertResult::Updated {
promoted_to_connected: false,
},
(UpdateResult::Updated, UpdateResult::UpdatedAndPromoted) => {
InsertResult::Updated {
promoted_to_connected: true,
}
}
(UpdateResult::Updated { .. }, UpdateResult::NotModified)
| (UpdateResult::Updated { .. }, UpdateResult::UpdatedPending) => {
(UpdateResult::Updated, UpdateResult::NotModified)
| (UpdateResult::Updated, UpdateResult::UpdatedPending) => {
InsertResult::ValueUpdated
}
(UpdateResult::NotModified, UpdateResult::Updated) => {
Expand Down
8 changes: 4 additions & 4 deletions src/service/connectivity_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
//! 1. Our ENR socket gets updated
//! 2. This triggers us to set an incoming wait timer
//! 3. a. If we receive an incoming connection within this time, we consider ourselves contactable
//! and we remove the timer.
//! and we remove the timer.
//! 3. b. If we don't receive a connection and the timer expires. If the timer expires, we set our
//! external ENR address to None and set the `next_connectivity_test` to
//! DURATION_UNTIL_NEXT_CONNECTIVITY_ATTEMPT in the future. This will prevent counting votes until
//! this time, which prevents our ENR from being updated.
//! external ENR address to None and set the `next_connectivity_test` to
//! DURATION_UNTIL_NEXT_CONNECTIVITY_ATTEMPT in the future. This will prevent counting votes until
//! this time, which prevents our ENR from being updated.

use crate::metrics::METRICS;
use futures::{
Expand Down