mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 10:52:43 +00:00
Generalize sync ActiveRequests (#6398)
* Generalize sync ActiveRequests * Remove impossible to hit test * Update beacon_node/lighthouse_network/src/service/api_types.rs Co-authored-by: realbigsean <sean@sigmaprime.io> * Update beacon_node/network/src/sync/network_context.rs Co-authored-by: realbigsean <sean@sigmaprime.io> * Update beacon_node/network/src/sync/network_context.rs Co-authored-by: realbigsean <sean@sigmaprime.io> * Simplify match * Fix display * Merge remote-tracking branch 'sigp/unstable' into sync-active-request-generalize * Sampling requests should not expect all responses * Merge remote-tracking branch 'sigp/unstable' into sync-active-request-generalize * Fix sampling_batch_requests_not_enough_responses_returned test * Merge remote-tracking branch 'sigp/unstable' into sync-active-request-generalize * Merge branch 'unstable' of https://github.com/sigp/lighthouse into sync-active-request-generalize
This commit is contained in:
@@ -88,7 +88,11 @@ impl<T: BeaconChainTypes> Sampling<T> {
|
||||
}
|
||||
};
|
||||
|
||||
debug!(self.log, "Created new sample request"; "id" => ?id);
|
||||
debug!(self.log,
|
||||
"Created new sample request";
|
||||
"id" => ?id,
|
||||
"column_selection" => ?request.column_selection()
|
||||
);
|
||||
|
||||
// TOOD(das): If a node has very little peers, continue_sampling() will attempt to find enough
|
||||
// to sample here, immediately failing the sampling request. There should be some grace
|
||||
@@ -239,6 +243,15 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
|
||||
self.column_requests.get(index).map(|req| req.status())
|
||||
}
|
||||
|
||||
/// Return the current ordered list of columns that this requests has to sample to succeed
|
||||
pub(crate) fn column_selection(&self) -> Vec<ColumnIndex> {
|
||||
self.column_shuffle
|
||||
.iter()
|
||||
.take(REQUIRED_SUCCESSES[0])
|
||||
.copied()
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Insert a downloaded column into an active sampling request. Then make progress on the
|
||||
/// entire request.
|
||||
///
|
||||
@@ -531,6 +544,10 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
|
||||
block_root: self.block_root,
|
||||
indices: column_indexes.clone(),
|
||||
},
|
||||
// false = We issue request to custodians who may or may not have received the
|
||||
// samples yet. We don't any signal (like an attestation or status messages that the
|
||||
// custodian has received data).
|
||||
false,
|
||||
)
|
||||
.map_err(SamplingError::SendFailed)?;
|
||||
self.column_indexes_by_sampling_request
|
||||
|
||||
Reference in New Issue
Block a user