refactor(trie): improve storage proof handling in parallel processing

- Added logic to drain receivers for accounts not touched by the walker, allowing workers to deliver results without encountering closed channels.
- Enhanced error handling for closed channels during storage proof reception, ensuring robustness in parallel processing.
This commit is contained in:
Yong Kang
2025-10-07 04:31:28 +00:00
parent b507803547
commit 8803b532b3

View File

@@ -321,6 +321,17 @@ where
}
}
}
// Drain receivers for accounts the walker never touched (e.g. destroyed targets) so workers
// can deliver their results without hitting a closed channel.
for (hashed_address, rx) in storage_proof_receivers {
let decoded_storage_multiproof = rx.recv().map_err(|e| {
ParallelStateRootError::StorageRoot(StorageRootError::Database(
DatabaseError::Other(format!("channel closed for {hashed_address}: {e}")),
))
})??;
collected_decoded_storages.insert(hashed_address, decoded_storage_multiproof);
}
let _ = hash_builder.root();
let stats = tracker.finish();