librustzcash icon indicating copy to clipboard operation
librustzcash copied to clipboard

zcash_client_backend: Introduce (initially internal) "sync API" between the scanning and wallet parts of `scan_cached_blocks`

Open str4d opened this issue 10 months ago • 0 comments

Currently scan_cached_blocks takes a BlockSource and a WalletWrite, and combines their information to scan a given range of blocks. It would be useful to clearly denote the dataflows here, as we have the following conceptual relationship that we would like to embody in the zcashd wallet replacement:

sequenceDiagram
    Wallet->>Scanner: Viewing keys
    Wallet->>Scanner: Nullifiers, scan range
    Scanner->>Block Source: Request blocks
    Block Source-->>+Scanner: Blocks
    Scanner-->>-Wallet: Scanned notes

We should ensure that the individual logic necessary for these three components is accessible from zcash_client_backend, by refactoring the internals of scan_cached_blocks to leverage them in this way. This might coincide with the exposition of the BatchRunners type, or it might just mean exposing a wrapper around it that a future Scanner could use.

str4d avatar Apr 24 '24 17:04 str4d