mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
BN Fallback v2 (#2080)
## Issue Addressed - Resolves #1883 ## Proposed Changes This follows on from @blacktemplar's work in #2018. - Allows the VC to connect to multiple BN for redundancy. - Update the simulator so some nodes always need to rely on their fallback. - Adds some extra deprecation warnings for `--eth1-endpoint` - Pass `SignatureBytes` as a reference instead of by value. ## Additional Info NA Co-authored-by: blacktemplar <blacktemplar@a1.net>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::{is_synced::is_synced, ProductionValidatorClient};
|
||||
use crate::ProductionValidatorClient;
|
||||
use futures::StreamExt;
|
||||
use slog::{error, info};
|
||||
use slot_clock::SlotClock;
|
||||
@@ -10,7 +10,6 @@ pub fn spawn_notifier<T: EthSpec>(client: &ProductionValidatorClient<T>) -> Resu
|
||||
let context = client.context.service_context("notifier".into());
|
||||
let executor = context.executor.clone();
|
||||
let duties_service = client.duties_service.clone();
|
||||
let allow_unsynced_beacon_node = client.config.allow_unsynced_beacon_node;
|
||||
|
||||
let slot_duration = Duration::from_millis(context.eth2_config.spec.milliseconds_per_slot);
|
||||
let duration_to_next_slot = duties_service
|
||||
@@ -26,15 +25,25 @@ pub fn spawn_notifier<T: EthSpec>(client: &ProductionValidatorClient<T>) -> Resu
|
||||
let log = context.log();
|
||||
|
||||
while interval.next().await.is_some() {
|
||||
if !is_synced(
|
||||
&duties_service.beacon_node,
|
||||
&duties_service.slot_clock,
|
||||
Some(&log),
|
||||
)
|
||||
.await
|
||||
&& !allow_unsynced_beacon_node
|
||||
{
|
||||
continue;
|
||||
let num_available = duties_service.beacon_nodes.num_available().await;
|
||||
let num_synced = duties_service.beacon_nodes.num_synced().await;
|
||||
let num_total = duties_service.beacon_nodes.num_total().await;
|
||||
if num_synced > 0 {
|
||||
info!(
|
||||
log,
|
||||
"Connected to beacon node(s)";
|
||||
"total" => num_total,
|
||||
"available" => num_available,
|
||||
"synced" => num_synced,
|
||||
)
|
||||
} else {
|
||||
error!(
|
||||
log,
|
||||
"No synced beacon nodes";
|
||||
"total" => num_total,
|
||||
"available" => num_available,
|
||||
"synced" => num_synced,
|
||||
)
|
||||
}
|
||||
|
||||
if let Some(slot) = duties_service.slot_clock.now() {
|
||||
|
||||
Reference in New Issue
Block a user