fix: improve more docs and more refactoring

Thank you @vladimirfomene for these suggestions.

* Rename `LocalUpdate::keychain` to `LocalUpdate::last_active_indices`.
* Change docs for `CheckPoint` to be more descriptive.
* Fix incorrect logic in `update_local_chain` for `EsploraExt` and
  `EsploraAsyncExt`.
This commit is contained in:
志宇
2023-07-22 19:42:12 +08:00
parent 95312d4d05
commit db15e03bdc
9 changed files with 21 additions and 16 deletions

View File

@@ -10,9 +10,13 @@ use bitcoin::BlockHash;
/// A structure that represents changes to [`LocalChain`].
pub type ChangeSet = BTreeMap<u32, Option<BlockHash>>;
/// A blockchain of [`LocalChain`].
/// A [`LocalChain`] checkpoint is used to find the agreement point between two chains and as a
/// transaction anchor.
///
/// The in a linked-list with newer blocks pointing to older ones.
/// Each checkpoint contains the height and hash of a block ([`BlockId`]).
///
/// Internaly, checkpoints are nodes of a linked-list. This allows the caller to view the entire
/// chain without holding a lock to [`LocalChain`].
#[derive(Debug, Clone)]
pub struct CheckPoint(Arc<CPInner>);
@@ -382,7 +386,7 @@ impl LocalChain {
}
}
/// Get a reference to the internal index mapping the height to block hash
/// Get a reference to the internal index mapping the height to block hash.
pub fn heights(&self) -> &BTreeMap<u32, BlockHash> {
&self.index
}