Merge branch 'master' into proto-array + more changes

This commit is contained in:
Paul Hauner
2020-01-15 07:46:07 +11:00
79 changed files with 2318 additions and 897 deletions

View File

@@ -37,6 +37,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
) -> Result<Signal, String> {
let log_1 = context.log.clone();
let log_2 = context.log.clone();
let log_3 = context.log.clone();
let slot_duration = Duration::from_millis(milliseconds_per_slot);
let duration_to_next_slot = beacon_chain
@@ -69,7 +70,12 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
usize::max_value()
};
let head = beacon_chain.head();
let head = beacon_chain.head()
.map_err(|e| error!(
log,
"Failed to get beacon chain head";
"error" => format!("{:?}", e)
))?;
let head_slot = head.beacon_block.slot;
let head_epoch = head_slot.epoch(T::EthSpec::slots_per_epoch());
@@ -117,9 +123,9 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
log,
"Syncing";
"peers" => peer_count_pretty(connected_peer_count),
"est_time" => estimated_time_pretty(speedo.estimated_time_till_slot(current_slot)),
"distance" => distance,
"speed" => sync_speed_pretty(speedo.slots_per_second()),
"distance" => distance
"est_time" => estimated_time_pretty(speedo.estimated_time_till_slot(current_slot)),
);
return Ok(());
@@ -156,6 +162,16 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
};
Ok(())
})
.then(move |result| {
match result {
Ok(()) => Ok(()),
Err(e) => Ok(error!(
log_3,
"Notifier failed to notify";
"error" => format!("{:?}", e)
))
}
});
let (exit_signal, exit) = exit_future::signal();