@@ -113,17 +113,25 @@ impl IntoIterator for CheckPoint {
113113 }
114114}
115115
116- /// Represents an update to [`LocalChain`].
116+ /// A struct to update [`LocalChain`].
117+ ///
118+ /// This is used as input for [`LocalChain::apply_update`]. It contains the update's chain `tip` and
119+ /// a `bool` which signals whether this update can introduce blocks below the original chain's tip
120+ /// without invalidating blocks residing on the original chain. Block-by-block syncing mechanisms
121+ /// would typically create updates that builds upon the previous tip. In this case, this paramater
122+ /// would be `false`. Script-pubkey based syncing mechanisms may not introduce transactions in a
123+ /// chronological order so some updates require introducing older blocks (to anchor older
124+ /// transactions). For script-pubkey based syncing, this parameter would typically be `true`.
117125#[ derive( Debug , Clone ) ]
118126pub struct Update {
119- /// The update's new [`CheckPoint`] tip.
127+ /// The update chain 's new tip.
120128 pub tip : CheckPoint ,
121129
122130 /// Whether the update allows for introducing older blocks.
123131 ///
124- /// Refer to [`LocalChain::apply_update` ] for more.
132+ /// Refer to [struct-level documentation ] for more.
125133 ///
126- /// [`LocalChain::apply_update` ]: crate::local_chain::LocalChain::apply_update
134+ /// [struct-level documentation ]: Update
127135 pub introduce_older_blocks : bool ,
128136}
129137
@@ -146,12 +154,6 @@ impl From<LocalChain> for BTreeMap<u32, BlockHash> {
146154 }
147155}
148156
149- impl From < ChangeSet > for LocalChain {
150- fn from ( value : ChangeSet ) -> Self {
151- Self :: from_changeset ( value)
152- }
153- }
154-
155157impl From < BTreeMap < u32 , BlockHash > > for LocalChain {
156158 fn from ( value : BTreeMap < u32 , BlockHash > ) -> Self {
157159 Self :: from_blocks ( value)
@@ -244,18 +246,9 @@ impl LocalChain {
244246 self . tip . is_none ( )
245247 }
246248
247- /// Updates [`Self`] with the given `update_tip`.
248- ///
249- /// `introduce_older_blocks` specifies whether the `update_tip`'s history can introduce blocks
250- /// below the original chain's tip without invalidating blocks. Block-by-block syncing
251- /// mechanisms would typically create updates that builds upon the previous tip. In this case,
252- /// this paramater would be false. Script-pubkey based syncing mechanisms may not introduce
253- /// transactions in a chronological order so some updates require introducing older blocks (to
254- /// anchor older transactions). For script-pubkey based syncing, this parameter would typically
255- /// be true.
249+ /// Applies the given `update` to the chain.
256250 ///
257- /// The method returns [`ChangeSet`] on success. This represents the applied changes to
258- /// [`Self`].
251+ /// The method returns [`ChangeSet`] on success. This represents the applied changes to `self`.
259252 ///
260253 /// To update, the `update_tip` must *connect* with `self`. If `self` and `update_tip` has a
261254 /// mutual checkpoint (same height and hash), it can connect if:
@@ -275,7 +268,7 @@ impl LocalChain {
275268 ///
276269 /// An error will occur if the update does not correctly connect with `self`.
277270 ///
278- /// Refer to [module-level documentation ] for more.
271+ /// Refer to [`Update` ] for more about the update struct .
279272 ///
280273 /// [module-level documentation]: crate::local_chain
281274 pub fn apply_update ( & mut self , update : Update ) -> Result < ChangeSet , CannotConnectError > {
0 commit comments