librustzcash
librustzcash copied to clipboard
zcash_client_backend: Add cache insertion and deletion APIs to `BlockSource` trait or a new trait
Currently the BlockSource
trait only exposes a generic way to access cached blocks. However, if we want to provide a generic state machine (#1169), we will need a generic way to perform the following operations:
- Insert downloaded
CompactBlock
s into the cache. - Mark previously-cached blocks as scanned (to trigger cache removal at some point).
- Remove all cached blocks above some height (for rollbacks).
We might want to do this as part of BlockSource
, but more likely we will have a new BlockCache: BlockSource
trait providing these capabilities.