mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Log ttd (#3339)
## Issue Addressed Resolves #3249 ## Proposed Changes Log merge related parameters and EE status in the beacon notifier before the merge. Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
@@ -234,6 +234,16 @@ impl<T: EthSpec> ExecutionLayer<T> {
|
||||
&self.inner.executor
|
||||
}
|
||||
|
||||
/// Get the current difficulty of the PoW chain.
|
||||
pub async fn get_current_difficulty(&self) -> Result<Uint256, ApiError> {
|
||||
let block = self
|
||||
.engine()
|
||||
.api
|
||||
.get_block_by_number(BlockByNumberQuery::Tag(LATEST_TAG))
|
||||
.await?
|
||||
.ok_or(ApiError::ExecutionHeadBlockNotFound)?;
|
||||
Ok(block.total_difficulty)
|
||||
}
|
||||
/// Note: this function returns a mutex guard, be careful to avoid deadlocks.
|
||||
async fn execution_blocks(
|
||||
&self,
|
||||
@@ -355,6 +365,29 @@ impl<T: EthSpec> ExecutionLayer<T> {
|
||||
self.engine().is_synced().await
|
||||
}
|
||||
|
||||
/// Execution nodes return a "SYNCED" response when they do not have any peers.
|
||||
///
|
||||
/// This function is a wrapper over `Self::is_synced` that makes an additional
|
||||
/// check for the execution layer sync status. Checks if the latest block has
|
||||
/// a `block_number != 0`.
|
||||
/// Returns the `Self::is_synced` response if unable to get latest block.
|
||||
pub async fn is_synced_for_notifier(&self) -> bool {
|
||||
let synced = self.is_synced().await;
|
||||
if synced {
|
||||
if let Ok(Some(block)) = self
|
||||
.engine()
|
||||
.api
|
||||
.get_block_by_number(BlockByNumberQuery::Tag(LATEST_TAG))
|
||||
.await
|
||||
{
|
||||
if block.block_number == 0 {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
synced
|
||||
}
|
||||
|
||||
/// Updates the proposer preparation data provided by validators
|
||||
pub async fn update_proposer_preparation(
|
||||
&self,
|
||||
|
||||
@@ -132,6 +132,15 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
|
||||
Ok(serde_json::to_value(response).unwrap())
|
||||
}
|
||||
ENGINE_EXCHANGE_TRANSITION_CONFIGURATION_V1 => {
|
||||
let block_generator = ctx.execution_block_generator.read();
|
||||
let transition_config: TransitionConfigurationV1 = TransitionConfigurationV1 {
|
||||
terminal_total_difficulty: block_generator.terminal_total_difficulty,
|
||||
terminal_block_hash: block_generator.terminal_block_hash,
|
||||
terminal_block_number: block_generator.terminal_block_number,
|
||||
};
|
||||
Ok(serde_json::to_value(transition_config).unwrap())
|
||||
}
|
||||
other => Err(format!(
|
||||
"The method {} does not exist/is not available",
|
||||
other
|
||||
|
||||
Reference in New Issue
Block a user