Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 15 additions & 30 deletions lean_client/networking/src/network/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1789,36 +1789,21 @@ where
tokio::spawn(async move {
for block in blocks {
let slot = block.block.slot.0;
match chain_sink.try_send(ChainMessage::ProcessBlock {
signed_block: block,
is_trusted: false,
should_gossip: false,
cached_post_state: None,
}) {
Ok(()) => {}
Err(tokio::sync::mpsc::error::TrySendError::Full(
_,
)) => {
warn!(
slot,
protocol = "blocks_by_range",
"Dropping RPC chunk: chain channel full"
);
METRICS.get().map(|m| {
m.lean_chain_message_drop_total
.with_label_values(&["blocks_by_range"])
.inc()
});
}
Err(
tokio::sync::mpsc::error::TrySendError::Closed(_),
) => {
warn!(
slot,
"Failed to forward range block to chain: channel closed"
);
break;
}
if let Err(err) = chain_sink
.send(ChainMessage::ProcessBlock {
signed_block: block,
is_trusted: false,
should_gossip: false,
cached_post_state: None,
})
.await
{
warn!(
slot,
?err,
"Failed to forward range block to chain"
);
break;
}
}
});
Expand Down
9 changes: 5 additions & 4 deletions lean_client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ fn dispatch_backfill(
orphan_count: usize,
outbound_p2p_sender: &mpsc::UnboundedSender<OutboundP2pRequest>,
) {
if !missing.is_empty() {
if let Err(e) = outbound_p2p_sender.send(OutboundP2pRequest::RequestBlocksByRoot(missing)) {
warn!("Failed to dispatch BlocksByRoot backfill: {}", e);
}
}
if orphan_count >= BACKFILL_ORPHAN_TRIGGER {
let request = OutboundP2pRequest::RequestBlocksByRange {
start_slot: local_head_slot.saturating_add(1),
Expand All @@ -72,10 +77,6 @@ fn dispatch_backfill(
if let Err(e) = outbound_p2p_sender.send(request) {
warn!("Failed to dispatch BlocksByRange backfill: {}", e);
}
} else if !missing.is_empty() {
if let Err(e) = outbound_p2p_sender.send(OutboundP2pRequest::RequestBlocksByRoot(missing)) {
warn!("Failed to dispatch BlocksByRoot backfill: {}", e);
}
}
}

Expand Down
Loading