mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-02 04:03:35 +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:
@@ -403,6 +403,7 @@ impl ProposerPreparationDataEntry {
|
||||
pub struct ProposerKey {
|
||||
slot: Slot,
|
||||
head_block_root: Hash256,
|
||||
head_payload_status: fork_choice::PayloadStatus,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone)]
|
||||
@@ -1461,12 +1462,14 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
&self,
|
||||
slot: Slot,
|
||||
head_block_root: Hash256,
|
||||
head_payload_status: fork_choice::PayloadStatus,
|
||||
validator_index: u64,
|
||||
payload_attributes: PayloadAttributes,
|
||||
) -> bool {
|
||||
let proposers_key = ProposerKey {
|
||||
slot,
|
||||
head_block_root,
|
||||
head_payload_status,
|
||||
};
|
||||
|
||||
let existing = self.proposers().write().await.insert(
|
||||
@@ -1485,16 +1488,18 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
}
|
||||
|
||||
/// If there has been a proposer registered via `Self::insert_proposer` with a matching `slot`
|
||||
/// `head_block_root`, then return the appropriate `PayloadAttributes` for inclusion in
|
||||
/// `forkchoiceUpdated` calls.
|
||||
/// `head_block_root`, and `head_payload_status` then return the appropriate `PayloadAttributes`
|
||||
/// for inclusion in `forkchoiceUpdated` calls.
|
||||
pub async fn payload_attributes(
|
||||
&self,
|
||||
current_slot: Slot,
|
||||
head_block_root: Hash256,
|
||||
head_payload_status: fork_choice::PayloadStatus,
|
||||
) -> Option<PayloadAttributes> {
|
||||
let proposers_key = ProposerKey {
|
||||
slot: current_slot,
|
||||
head_block_root,
|
||||
head_payload_status,
|
||||
};
|
||||
|
||||
let proposer = self.proposers().read().await.get(&proposers_key).cloned()?;
|
||||
@@ -1518,6 +1523,7 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
finalized_block_hash: ExecutionBlockHash,
|
||||
current_slot: Slot,
|
||||
head_block_root: Hash256,
|
||||
head_payload_status: fork_choice::PayloadStatus,
|
||||
) -> Result<PayloadStatus, Error> {
|
||||
let _timer = metrics::start_timer_vec(
|
||||
&metrics::EXECUTION_LAYER_REQUEST_TIMES,
|
||||
@@ -1534,7 +1540,9 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
);
|
||||
|
||||
let next_slot = current_slot + 1;
|
||||
let payload_attributes = self.payload_attributes(next_slot, head_block_root).await;
|
||||
let payload_attributes = self
|
||||
.payload_attributes(next_slot, head_block_root, head_payload_status)
|
||||
.await;
|
||||
|
||||
// Compute the "lookahead", the time between when the payload will be produced and now.
|
||||
if let Some(ref payload_attributes) = payload_attributes
|
||||
|
||||
Reference in New Issue
Block a user