Skip to content

Commit 27d6dc8

Browse files
committed
docs: add an extra comment to Ledger::drop
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
1 parent ebfff4c commit 27d6dc8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ledger/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,11 @@ impl<N: Network, C: ConsensusStorage<N>> Ledger<N, C> {
515515
#[cfg(feature = "rocks")]
516516
impl<N: Network, C: ConsensusStorage<N>> Drop for InnerLedger<N, C> {
517517
fn drop(&mut self) {
518-
// Cache the block tree on shutdown.
518+
// Cache the block tree in order to speed up the next startup; this operation
519+
// is guaranteed to conclude as long as the destructors are allowed to run
520+
// (a clean shutdown, panic = "unwind", an explicit call to `drop`, etc.).
521+
// At the moment this code is executed, the Ledger is guaranteed to be owned
522+
// exclusively by this method, so no other activity may interrupt it.
519523
if let Err(e) = self.vm.block_store().cache_block_tree() {
520524
error!("Couldn't cache the block tree: {e}");
521525
}

0 commit comments

Comments
 (0)