fix(root): drop sparse trie tx sender when state updates finished (#14004)

This commit is contained in:
Alexey Shekhirin
2025-01-27 15:31:44 +00:00
committed by GitHub
parent 33bf34b2fb
commit 0fa79c6c65

View File

@ -630,6 +630,19 @@ where
StateRootMessage::FinishedStateUpdates => { StateRootMessage::FinishedStateUpdates => {
trace!(target: "engine::root", "processing StateRootMessage::FinishedStateUpdates"); trace!(target: "engine::root", "processing StateRootMessage::FinishedStateUpdates");
updates_finished = true; updates_finished = true;
let all_proofs_received = proofs_processed >= updates_received;
let no_pending = !self.proof_sequencer.has_pending();
if all_proofs_received && no_pending {
// drop the sender
sparse_trie_tx.take();
debug!(
target: "engine::root",
total_updates = updates_received,
total_proofs = proofs_processed,
"State updates finished and all proofs processed, ending calculation"
);
}
} }
StateRootMessage::ProofCalculated(proof_calculated) => { StateRootMessage::ProofCalculated(proof_calculated) => {
trace!(target: "engine::root", "processing StateRootMessage::ProofCalculated"); trace!(target: "engine::root", "processing StateRootMessage::ProofCalculated");
@ -660,7 +673,12 @@ where
if all_proofs_received && no_pending && updates_finished { if all_proofs_received && no_pending && updates_finished {
// drop the sender // drop the sender
sparse_trie_tx.take(); sparse_trie_tx.take();
debug!(target: "engine::root", total_updates = updates_received, total_proofs = proofs_processed, "All proofs processed, ending calculation"); debug!(
target: "engine::root",
total_updates = updates_received,
total_proofs = proofs_processed,
"All proofs processed, ending calculation"
);
} }
} }
StateRootMessage::RootCalculated { state_root, trie_updates, iterations } => { StateRootMessage::RootCalculated { state_root, trie_updates, iterations } => {