mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 05:07:12 +00:00
Resolve merge conflicts
This commit is contained in:
@@ -45,6 +45,7 @@ use crate::service::NetworkMessage;
|
||||
use crate::status::ToStatusMessage;
|
||||
use crate::sync::block_lookups::{
|
||||
BlobRequestState, BlockComponent, BlockRequestState, CustodyRequestState, DownloadResult,
|
||||
EnvelopeRequestState,
|
||||
};
|
||||
use crate::sync::custody_backfill_sync::CustodyBackFillSync;
|
||||
use crate::sync::network_context::{PeerGroup, RpcResponseResult};
|
||||
@@ -937,9 +938,9 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
debug!(
|
||||
%block_root,
|
||||
%parent_root,
|
||||
"Parent envelope not yet available, creating lookup"
|
||||
"Parent envelope not yet available, creating envelope lookup"
|
||||
);
|
||||
self.handle_unknown_parent(
|
||||
self.handle_unknown_parent_envelope(
|
||||
peer_id,
|
||||
block_root,
|
||||
parent_root,
|
||||
@@ -1057,6 +1058,40 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle a block whose parent block is known but parent envelope is missing.
|
||||
/// Creates an envelope-only lookup for the parent and a child lookup that waits for it.
|
||||
fn handle_unknown_parent_envelope(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
block_root: Hash256,
|
||||
parent_root: Hash256,
|
||||
slot: Slot,
|
||||
block_component: BlockComponent<T::EthSpec>,
|
||||
) {
|
||||
match self.should_search_for_block(Some(slot), &peer_id) {
|
||||
Ok(_) => {
|
||||
if self.block_lookups.search_child_and_parent_envelope(
|
||||
block_root,
|
||||
block_component,
|
||||
parent_root,
|
||||
peer_id,
|
||||
&mut self.network,
|
||||
) {
|
||||
// Lookups created
|
||||
} else {
|
||||
debug!(
|
||||
?block_root,
|
||||
?parent_root,
|
||||
"No lookup created for child and parent envelope"
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(reason) => {
|
||||
debug!(%block_root, %parent_root, reason, "Ignoring unknown parent envelope request");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_unknown_block_root(&mut self, peer_id: PeerId, block_root: Hash256) {
|
||||
match self.should_search_for_block(None, &peer_id) {
|
||||
Ok(_) => {
|
||||
@@ -1288,27 +1323,14 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
.network
|
||||
.on_single_envelope_response(id, peer_id, rpc_event)
|
||||
{
|
||||
match resp {
|
||||
Ok((envelope, seen_timestamp)) => {
|
||||
let block_root = envelope.beacon_block_root();
|
||||
debug!(
|
||||
?block_root,
|
||||
%id,
|
||||
"Downloaded payload envelope, sending for processing"
|
||||
);
|
||||
if let Err(e) = self.network.send_envelope_for_processing(
|
||||
id.req_id,
|
||||
envelope,
|
||||
seen_timestamp,
|
||||
block_root,
|
||||
) {
|
||||
error!(error = ?e, "Failed to send envelope for processing");
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
debug!(error = ?e, %id, "Payload envelope download failed");
|
||||
}
|
||||
}
|
||||
self.block_lookups
|
||||
.on_download_response::<EnvelopeRequestState<T::EthSpec>>(
|
||||
id,
|
||||
resp.map(|(value, seen_timestamp)| {
|
||||
(value, PeerGroup::from_single(peer_id), seen_timestamp)
|
||||
}),
|
||||
&mut self.network,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user