chore: improve LocalChain::apply_header_connected_to doc
This commit is contained in:
parent
8ec65f0b8e
commit
a4f28c079e
@ -370,12 +370,16 @@ impl LocalChain {
|
|||||||
Ok(changeset)
|
Ok(changeset)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the chain with a given [`Header`] and a `connected_to` [`BlockId`].
|
/// Update the chain with a given [`Header`] at `height` which you claim is connected to a existing block in the chain.
|
||||||
///
|
///
|
||||||
/// The `header` will be transformed into checkpoints - one for the current block and one for
|
/// This is useful when you have a block header that you want to record as part of the chain but
|
||||||
/// the previous block. Note that a genesis header will be transformed into only one checkpoint
|
/// don't necessarily know that the `prev_blockhash` is in the chain.
|
||||||
/// (as there are no previous blocks). The checkpoints will be applied to the chain via
|
///
|
||||||
/// [`apply_update`].
|
/// This will usually insert two new [`BlockId`]s into the chain: the header's block and the
|
||||||
|
/// header's `prev_blockhash` block. `connected_to` must already be in the chain but is allowed
|
||||||
|
/// to be `prev_blockhash` (in which case only one new block id will be inserted).
|
||||||
|
/// To be successful, `connected_to` must be chosen carefully so that `LocalChain`'s [update
|
||||||
|
/// rules][`apply_update`] are satisfied.
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
@ -386,7 +390,7 @@ impl LocalChain {
|
|||||||
///
|
///
|
||||||
/// [`ApplyHeaderError::CannotConnect`] occurs if the internal call to [`apply_update`] fails.
|
/// [`ApplyHeaderError::CannotConnect`] occurs if the internal call to [`apply_update`] fails.
|
||||||
///
|
///
|
||||||
/// [`apply_update`]: LocalChain::apply_update
|
/// [`apply_update`]: Self::apply_update
|
||||||
pub fn apply_header_connected_to(
|
pub fn apply_header_connected_to(
|
||||||
&mut self,
|
&mut self,
|
||||||
header: &Header,
|
header: &Header,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user