Rephrase documentation for `validate_chain()` at data_api/chain.rs
Delete documentation no longer being accurate for `validate_chain()`
This commit is contained in:
parent
636bac7154
commit
444591705c
|
@ -25,26 +25,21 @@ and this library adheres to Rust's notion of
|
|||
- `validate_chain` now requires a non-optional `validate_from` parameter that
|
||||
indicates the starting point of the `BlockSourceT` validation. An Optional
|
||||
`limit` can be specified as well. This allows callers to validate smaller
|
||||
intervals of the given `BlockSourceT` shortening processing times of the
|
||||
function call at the expense of obtaining a partial result on a given
|
||||
section of interest of the block source.
|
||||
intervals of blocks already present on the provided `BlockSource` shortening
|
||||
processing times of the function call at the expense of obtaining a partial
|
||||
result.
|
||||
|
||||
- `params: &ParamsT` has been removed from the arguments since they were only
|
||||
needed to fall back to `sapling_activation_height` when `None` as passed as
|
||||
the `validate_from` argument. Passing `None` as validation start point on a
|
||||
pre-populated `block_source` would result in an error
|
||||
`ChainError::block_height_discontinuity(sapling_activation_height - 1, current_height)`
|
||||
the `validate_from` argument. Implementors of `BlockSource` are resposible
|
||||
of definining how they will fall back to a suitable value when `validate_from`
|
||||
is `None`.
|
||||
|
||||
- With this new API callers must specify a concrete `validate_from` argument
|
||||
and assume that `validate_chain` will not take any default fallbacks to
|
||||
chain `ParamsT`.
|
||||
|
||||
- The addition of a `limit` to the chain validation function changes the
|
||||
meaning of its successful output, being now a `BlockHeight, BlockHash)`
|
||||
tuple indicating the block height and block has up to which the chain as
|
||||
been validated on its continuity of heights and hashes. Callers providing a
|
||||
`limit` aregumente are responsible of subsequent calls to
|
||||
`validate_chain()` to complete validating the totality of the block_source.
|
||||
- When passing a `limit` to the chain validation function, a successful output,
|
||||
indicates that the chain has been validated on its continuity of heights and hashes
|
||||
within the limits of the range `[validate_from, validate_from + limit)`.
|
||||
Callers providing a `limit` argument are responsible for making subsequent calls to
|
||||
`validate_chain()` in order to complete validating the totality of the block_source.
|
||||
|
||||
### Removed
|
||||
- `zcash_client_backend::data_api`:
|
||||
|
|
|
@ -135,25 +135,21 @@ pub trait BlockSource {
|
|||
/// block source is more likely to be accurate than the previously-scanned information.
|
||||
/// This follows from the design (and trust) assumption that the `lightwalletd` server
|
||||
/// provides accurate block information as of the time it was requested.
|
||||
/// The addition of a `limit` to the chain validation function changes the meaning of
|
||||
/// its successful output, being now a `BlockHeight, BlockHash)` tuple indicating the
|
||||
/// block height and block hash up to which the chain as been validated on its continuity
|
||||
/// of heights and hashes. Callers providing a `limit` argument are responsible of
|
||||
/// making subsequent calls to `validate_chain()` to complete validating the remaining
|
||||
/// blocks stored on the `block_source`.
|
||||
///
|
||||
/// Arguments:
|
||||
/// - `block_source` Source of compact blocks
|
||||
/// - `validate_from` Height & hash of last validated block;
|
||||
/// - `limit` Maximum number of blocks that should be validated in this call.
|
||||
/// - `limit` specified number of blocks that will be valididated. Callers providing
|
||||
/// a `limit` argument are responsible of making subsequent calls to `validate_chain()`
|
||||
/// to complete validating the remaining blocks stored on the `block_source`. If `none`
|
||||
/// is provided, there will be no limit set to the validation and upper bound of the
|
||||
/// validation range will be the latest height present in the `block_source`.
|
||||
///
|
||||
/// Returns:
|
||||
/// - `Ok(())` if the combined chain is valid up to the given height
|
||||
/// and block hash.
|
||||
/// - `Err(Error::Chain(cause))` if the combined chain is invalid.
|
||||
/// - `Err(e)` if there was an error during validation unrelated to chain validity.
|
||||
///
|
||||
/// This function does not mutate either of the databases.
|
||||
pub fn validate_chain<BlockSourceT>(
|
||||
block_source: &BlockSourceT,
|
||||
mut validate_from: Option<(BlockHeight, BlockHash)>,
|
||||
|
|
Loading…
Reference in New Issue