mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Ensure VALID response from fcU updates protoarray (#3126)
## Issue Addressed NA ## Proposed Changes Ensures that a `VALID` response from a `forkchoiceUpdate` call will update that block in `ProtoArray`. I also had to modify the mock execution engine so it wouldn't return valid when all payloads were supposed to be some other static value. ## Additional Info NA
This commit is contained in:
@@ -100,7 +100,9 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
let forkchoice_state: JsonForkChoiceStateV1 = get_param(params, 0)?;
|
||||
let payload_attributes: Option<JsonPayloadAttributesV1> = get_param(params, 1)?;
|
||||
|
||||
let response = ctx
|
||||
let head_block_hash = forkchoice_state.head_block_hash;
|
||||
|
||||
let mut response = ctx
|
||||
.execution_block_generator
|
||||
.write()
|
||||
.forkchoice_updated_v1(
|
||||
@@ -108,6 +110,14 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
payload_attributes.map(|json| json.into()),
|
||||
)?;
|
||||
|
||||
if let Some(mut status) = ctx.static_forkchoice_updated_response.lock().clone() {
|
||||
if status.status == PayloadStatusV1Status::Valid {
|
||||
status.latest_valid_hash = Some(head_block_hash)
|
||||
}
|
||||
|
||||
response.payload_status = status.into();
|
||||
}
|
||||
|
||||
Ok(serde_json::to_value(response).unwrap())
|
||||
}
|
||||
other => Err(format!(
|
||||
|
||||
Reference in New Issue
Block a user