Add suggestions

This commit is contained in:
Mac L
2023-11-03 13:22:32 +11:00
parent 235c4524f7
commit 1d70441157
4 changed files with 10 additions and 11 deletions

1
Cargo.lock generated
View File

@@ -2099,6 +2099,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"account_utils", "account_utils",
"bytes", "bytes",
"derivative",
"eth2_keystore", "eth2_keystore",
"ethereum_serde_utils", "ethereum_serde_utils",
"ethereum_ssz", "ethereum_ssz",

View File

@@ -31,6 +31,7 @@ slashing_protection = { workspace = true }
mediatype = "0.19.13" mediatype = "0.19.13"
mime = "0.3.16" mime = "0.3.16"
pretty_reqwest_error = { workspace = true } pretty_reqwest_error = { workspace = true }
derivative = { workspace = true }
[dev-dependencies] [dev-dependencies]
tokio = { workspace = true } tokio = { workspace = true }

View File

@@ -16,6 +16,7 @@ pub mod types;
use self::mixin::{RequestAccept, ResponseOptional}; use self::mixin::{RequestAccept, ResponseOptional};
use self::types::{Error as ResponseError, *}; use self::types::{Error as ResponseError, *};
use derivative::Derivative;
use futures::Stream; use futures::Stream;
use futures_util::StreamExt; use futures_util::StreamExt;
use lighthouse_network::PeerId; use lighthouse_network::PeerId;
@@ -143,19 +144,15 @@ impl Timeouts {
/// A wrapper around `reqwest::Client` which provides convenience methods for interfacing with a /// A wrapper around `reqwest::Client` which provides convenience methods for interfacing with a
/// Lighthouse Beacon Node HTTP server (`http_api`). /// Lighthouse Beacon Node HTTP server (`http_api`).
#[derive(Clone, Debug)] #[derive(Clone, Debug, Derivative)]
#[derivative(PartialEq)]
pub struct BeaconNodeHttpClient { pub struct BeaconNodeHttpClient {
#[derivative(PartialEq = "ignore")]
client: reqwest::Client, client: reqwest::Client,
server: SensitiveUrl, server: SensitiveUrl,
timeouts: Timeouts, timeouts: Timeouts,
} }
impl PartialEq for BeaconNodeHttpClient {
fn eq(&self, other: &Self) -> bool {
self.server == other.server && self.timeouts == other.timeouts
}
}
impl Eq for BeaconNodeHttpClient {} impl Eq for BeaconNodeHttpClient {}
impl fmt::Display for BeaconNodeHttpClient { impl fmt::Display for BeaconNodeHttpClient {

View File

@@ -342,15 +342,15 @@ impl<T: EthSpec> ProductionValidatorClient<T> {
let candidates = beacon_nodes let candidates = beacon_nodes
.into_iter() .into_iter()
.zip(0..num_nodes) .enumerate()
.map(|(node, id)| CandidateBeaconNode::new(node, id)) .map(|(id, node)| CandidateBeaconNode::new(node, id))
.collect(); .collect();
let proposer_nodes_num = proposer_nodes.len(); let proposer_nodes_num = proposer_nodes.len();
let proposer_candidates = proposer_nodes let proposer_candidates = proposer_nodes
.into_iter() .into_iter()
.zip(0..num_nodes) .enumerate()
.map(|(node, id)| CandidateBeaconNode::new(node, id)) .map(|(id, node)| CandidateBeaconNode::new(node, id))
.collect(); .collect();
// Set the count for beacon node fallbacks excluding the primary beacon node. // Set the count for beacon node fallbacks excluding the primary beacon node.