mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 20:57:10 +00:00
Re-issue ForkchoiceUpdate based on updated PayloadStatus (#9102)
Co-Authored-By: hopinheimer <knmanas6@gmail.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
This commit is contained in:
@@ -771,6 +771,36 @@ where
|
||||
.execution_block_generator()
|
||||
}
|
||||
|
||||
/// Create a switch-to-compounding `ConsolidationRequest` for the given validator.
|
||||
///
|
||||
/// Panics if the validator doesn't exist, doesn't have eth1 withdrawal credentials,
|
||||
/// or doesn't have an execution withdrawal address.
|
||||
pub fn make_switch_to_compounding_request(
|
||||
&self,
|
||||
validator_index: usize,
|
||||
) -> ConsolidationRequest {
|
||||
let head = self.chain.canonical_head.cached_head();
|
||||
let head_state = &head.snapshot.beacon_state;
|
||||
let validator = head_state
|
||||
.get_validator(validator_index)
|
||||
.expect("validator should exist");
|
||||
|
||||
assert!(
|
||||
validator.has_eth1_withdrawal_credential(&self.spec),
|
||||
"validator {validator_index} should have eth1 withdrawal credentials"
|
||||
);
|
||||
|
||||
let source_address = validator
|
||||
.get_execution_withdrawal_address(&self.spec)
|
||||
.expect("validator should have execution withdrawal address");
|
||||
|
||||
ConsolidationRequest {
|
||||
source_address,
|
||||
source_pubkey: validator.pubkey,
|
||||
target_pubkey: validator.pubkey,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_mock_builder(
|
||||
&mut self,
|
||||
beacon_url: SensitiveUrl,
|
||||
|
||||
Reference in New Issue
Block a user