mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Define type and modify function
This commit is contained in:
@@ -948,6 +948,13 @@ pub struct PeerCount {
|
|||||||
pub disconnecting: u64,
|
pub disconnecting: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct BeaconCommitteeSelection {
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub validator_index: u64,
|
||||||
|
pub slot: Slot,
|
||||||
|
pub selection_proof: Signature,
|
||||||
|
}
|
||||||
// --------- Server Sent Event Types -----------
|
// --------- Server Sent Event Types -----------
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
|
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
|
||||||
|
|||||||
@@ -129,7 +129,21 @@ async fn make_selection_proof<T: SlotClock + 'static, E: EthSpec>(
|
|||||||
duty: &AttesterData,
|
duty: &AttesterData,
|
||||||
validator_store: &ValidatorStore<T, E>,
|
validator_store: &ValidatorStore<T, E>,
|
||||||
spec: &ChainSpec,
|
spec: &ChainSpec,
|
||||||
|
distributed: bool,
|
||||||
|
beacon_nodes: &Arc<BeaconNodeFallback<T, E>>,
|
||||||
) -> Result<Option<SelectionProof>, Error> {
|
) -> Result<Option<SelectionProof>, Error> {
|
||||||
|
if distributed {
|
||||||
|
// call the middleware for the endpoint /eth/v1/validator/beacon_committee_subscriptions
|
||||||
|
beacon_nodes
|
||||||
|
.first_success(|beacon_node| async move {
|
||||||
|
beacon_node
|
||||||
|
.post_validator_beacon_committee_subscriptions()
|
||||||
|
.await
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.map_err(|e| Error::FailedToProduceSelectionProof(e.to_string()))
|
||||||
|
.map(|_| None)
|
||||||
|
} else {
|
||||||
let selection_proof = validator_store
|
let selection_proof = validator_store
|
||||||
.produce_selection_proof(duty.pubkey, duty.slot)
|
.produce_selection_proof(duty.pubkey, duty.slot)
|
||||||
.await
|
.await
|
||||||
@@ -148,6 +162,7 @@ async fn make_selection_proof<T: SlotClock + 'static, E: EthSpec>(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl DutyAndProof {
|
impl DutyAndProof {
|
||||||
/// Create a new `DutyAndProof` with the selection proof waiting to be filled in.
|
/// Create a new `DutyAndProof` with the selection proof waiting to be filled in.
|
||||||
@@ -1101,6 +1116,8 @@ async fn fill_in_selection_proofs<T: SlotClock + 'static, E: EthSpec>(
|
|||||||
&duty,
|
&duty,
|
||||||
&duties_service.validator_store,
|
&duties_service.validator_store,
|
||||||
&duties_service.spec,
|
&duties_service.spec,
|
||||||
|
duties_service.distributed,
|
||||||
|
&duties_service.beacon_nodes,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok((duty, opt_selection_proof))
|
Ok((duty, opt_selection_proof))
|
||||||
|
|||||||
Reference in New Issue
Block a user