librustzcash icon indicating copy to clipboard operation
librustzcash copied to clipboard

Better Support for progress indication to clients when validating and scanning

Open pacu opened this issue 3 years ago • 1 comments

As a wallet developer I would like to show progress to my users.

Combined chained validation

Currently wallets can download thousands of blocks at a time and scan them in batches, which is not the case for the intermediate validation step which is performed by calling the function below.

data_ap/chain.rs

pub fn validate_chain<N, E, P, C>(
    parameters: &P,
    cache: &C,
    validate_from: Option<(BlockHeight, BlockHash)>,
) -> Result<(), E>

Examples where this has been applied:

pub fn scan_cached_blocks<E, N, P, C, D>(
    params: &P,
    cache: &C,
    data: &mut D,
    limit: Option<u32>,
) -> Result<(), E>

proposal

pub fn validate_chain<N, E, P, C>(
    parameters: &P,
    cache: &C,
    validate_from: Option<(BlockHeight, BlockHash)>,
    limit: Option<BlockHeight>,
) -> Result<(), E>

Return latest scanned height instead of just Void for success

When Scanning blocks, the scanning progress can be done in batches using limit and start. To better serve wallet developers I propose that the return value of scan_blocks is changed to a more meaningful result value than just Void, by returning the latest_scanned_height instead

Proposal

pub fn scan_cached_blocks<E, N, P, C, D>(
    params: &P,
    cache: &C,
    data: &mut D,
    limit: Option<u32>,
) -> Result<BlockHeight, E>

pacu avatar May 28 '21 19:05 pacu