Skip to content

Commit 6d59782

Browse files
interrupt prefetch after state root calc
1 parent a4cd2cd commit 6d59782

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

crates/blockchain-tree/src/chain.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ impl AppendableChain {
236236

237237
let initial_execution_outcome = ExecutionOutcome::from((state, block.number));
238238

239-
// stop the prefetch task.
240-
if let Some(interrupt_tx) = interrupt_tx {
241-
let _ = interrupt_tx.send(());
242-
}
239+
// // stop the prefetch task.
240+
// if let Some(interrupt_tx) = interrupt_tx {
241+
// let _ = interrupt_tx.send(());
242+
// }
243243

244244
// check state root if the block extends the canonical chain __and__ if state root
245245
// validation was requested.
@@ -262,6 +262,12 @@ impl AppendableChain {
262262
let state_root = provider.state_root(hashed_state)?;
263263
(state_root, None)
264264
};
265+
266+
// stop the prefetch task.
267+
if let Some(interrupt_tx) = interrupt_tx {
268+
let _ = interrupt_tx.send(());
269+
}
270+
265271
if block.state_root != state_root {
266272
tracing::debug!(
267273
target: "blockchain_tree::chain",
@@ -286,6 +292,11 @@ impl AppendableChain {
286292

287293
Ok((initial_execution_outcome, trie_updates))
288294
} else {
295+
// stop the prefetch task.
296+
if let Some(interrupt_tx) = interrupt_tx {
297+
let _ = interrupt_tx.send(());
298+
}
299+
289300
Ok((initial_execution_outcome, None))
290301
}
291302
}

0 commit comments

Comments
 (0)