@@ -21,7 +21,7 @@ use crate::{
2121/// Type we use to manage the Sync Task handle map.
2222type LiveChainBlockList = SkipMap < Point , MultiEraBlock > ;
2323
24- /// Because we have multi-entry relationships in the live-chain protect it with a
24+ /// Because we have multi-entry relationships in the live-chain, it need to protect it with a
2525/// `read/write lock`. The underlying `SkipMap` is still capable of multiple simultaneous
2626/// reads from multiple threads which is the most common access.
2727#[ derive( Clone ) ]
@@ -50,7 +50,8 @@ fn update_peer_tip(chain: Network, tip: Point) {
5050 PEER_TIP . insert ( chain, tip) ;
5151}
5252
53- /// Set the last TIP received from the peer.
53+ /// Get the last TIP received from the peer.
54+ /// If the peer tip doesn't exist, get the UNKNOWN point.
5455pub ( crate ) fn get_peer_tip ( chain : Network ) -> Point {
5556 ( * PEER_TIP . get_or_insert ( chain, Point :: UNKNOWN ) . value ( ) ) . clone ( )
5657}
@@ -117,7 +118,7 @@ impl ProtectedLiveChainBlockList {
117118 Ok ( check_first_live_block. point ( ) )
118119 }
119120
120- /// Get the point of the first known block in the Live Chain.
121+ /// Get the point of the last known block in the Live Chain.
121122 fn get_last_live_point ( live_chain : & LiveChainBlockList ) -> Point {
122123 let Some ( check_last_live_entry) = live_chain. back ( ) else {
123124 // Its not an error if we can't get a latest block because the chain is empty,
@@ -151,7 +152,7 @@ impl ProtectedLiveChainBlockList {
151152 ) ) ) ;
152153 }
153154
154- // Get the current Oldest block in the live chain.
155+ // Get the current oldest block in the live chain.
155156 let check_first_live_point = Self :: get_first_live_point ( & live_chain) ?;
156157
157158 let last_backfill_block = blocks
@@ -160,7 +161,7 @@ impl ProtectedLiveChainBlockList {
160161 . clone ( ) ;
161162 let last_backfill_point = last_backfill_block. point ( ) ;
162163
163- // Make sure the backfill will properly connect the partial Live chain to the Mithril
164+ // Make sure the backfill will properly connect the partial live chain to the Mithril
164165 // chain.
165166 if !last_backfill_point. strict_eq ( & check_first_live_point) {
166167 return Err ( Error :: LiveSync ( format ! (
@@ -179,8 +180,8 @@ impl ProtectedLiveChainBlockList {
179180 Ok ( ( ) )
180181 }
181182
182- /// Check if the given point is strictly in the live-chain. This means the slot and
183- /// Hash MUST be present.
183+ /// Check if the given point is strictly in the live-chain. This means the slot and
184+ /// block hash MUST be present.
184185 fn strict_block_lookup ( live_chain : & LiveChainBlockList , point : & Point ) -> bool {
185186 if let Some ( found_block) = live_chain. get ( point) {
186187 return found_block. value ( ) . point ( ) . strict_eq ( point) ;
@@ -451,7 +452,7 @@ pub(crate) fn get_live_block(
451452 live_chain. get_block ( point, advance, strict)
452453}
453454
454- /// Get the fill tp point for a chain.
455+ /// Get the fill to point for a chain.
455456///
456457/// Returns the Point of the block we are filling up-to, and it's fork count.
457458///
@@ -493,7 +494,7 @@ pub(crate) fn live_chain_length(chain: Network) -> usize {
493494 live_chain. len ( )
494495}
495496
496- /// On an immutable update, purge the live- chain up to the new immutable tip.
497+ /// On an immutable update, purge the live chain up to the new immutable tip.
497498/// Will error if the point is not in the Live chain.
498499pub ( crate ) fn purge_live_chain ( chain : Network , point : & Point ) -> Result < ( ) > {
499500 let live_chain = get_live_chain ( chain) ;
0 commit comments