Skip to content

Commit 64c96ff

Browse files
authored
Merge of #6816
2 parents 88bb14c + 0df2384 commit 64c96ff

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

beacon_node/beacon_chain/src/fetch_blobs.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,20 @@ pub async fn fetch_and_process_engine_blobs<T: BeaconChainTypes>(
163163
return Ok(None);
164164
}
165165

166+
if chain
167+
.canonical_head
168+
.fork_choice_read_lock()
169+
.contains_block(&block_root)
170+
{
171+
// Avoid computing columns if block has already been imported.
172+
debug!(
173+
log,
174+
"Ignoring EL blobs response";
175+
"info" => "block has already been imported",
176+
);
177+
return Ok(None);
178+
}
179+
166180
let data_columns_receiver = spawn_compute_and_publish_data_columns_task(
167181
&chain,
168182
block.clone(),
@@ -248,18 +262,21 @@ fn spawn_compute_and_publish_data_columns_task<T: BeaconChainTypes>(
248262
}
249263
};
250264

251-
if let Err(e) = data_columns_sender.send(all_data_columns.clone()) {
252-
error!(log, "Failed to send computed data columns"; "error" => ?e);
265+
if data_columns_sender.send(all_data_columns.clone()).is_err() {
266+
// Data column receiver have been dropped - block may have already been imported.
267+
// This race condition exists because gossip columns may arrive and trigger block
268+
// import during the computation. Here we just drop the computed columns.
269+
debug!(
270+
log,
271+
"Failed to send computed data columns";
272+
);
273+
return;
253274
};
254275

255-
// Check indices from cache before sending the columns, to make sure we don't
256-
// publish components already seen on gossip.
257-
let is_supernode = chain_cloned.data_availability_checker.is_supernode();
258-
259276
// At the moment non supernodes are not required to publish any columns.
260277
// TODO(das): we could experiment with having full nodes publish their custodied
261278
// columns here.
262-
if !is_supernode {
279+
if !chain_cloned.data_availability_checker.is_supernode() {
263280
return;
264281
}
265282

0 commit comments

Comments
 (0)