mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +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:
@@ -4032,7 +4032,25 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
|
||||
match forkchoice_updated_response {
|
||||
Ok(status) => match &status {
|
||||
PayloadStatus::Valid | PayloadStatus::Syncing => Ok(()),
|
||||
PayloadStatus::Valid => {
|
||||
// Ensure that fork choice knows that the block is no longer optimistic.
|
||||
if let Err(e) = self
|
||||
.fork_choice
|
||||
.write()
|
||||
.on_valid_execution_payload(head_block_root)
|
||||
{
|
||||
error!(
|
||||
self.log,
|
||||
"Failed to validate payload";
|
||||
"error" => ?e
|
||||
)
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
// There's nothing to be done for a syncing response. If the block is already
|
||||
// `SYNCING` in fork choice, there's nothing to do. If already known to be `VALID`
|
||||
// or `INVALID` then we don't want to change it to syncing.
|
||||
PayloadStatus::Syncing => Ok(()),
|
||||
// The specification doesn't list `ACCEPTED` as a valid response to a fork choice
|
||||
// update. This response *seems* innocent enough, so we won't return early with an
|
||||
// error. However, we create a log to bring attention to the issue.
|
||||
|
||||
Reference in New Issue
Block a user