librustzcash
librustzcash copied to clipboard
Implement BlockCache trait for FsBlockDb
- Implements Sync trait for BlockDb and FsBlockDb (trait bound for BlockCache trait)
- Implements BlockCache for FsBlockDb
- Scan_cached_blocks takes a BlockCache instead of BlockSource to solve issues with thread safety with callback and also update the sync engine to use only BlockCache trait methods
- Changes fns and tests to async as a result of implementing Sync trait for BlockDb and FsBlockDb
- implements
BlockCache::readfor BlockDb, neccessary for callingscan_cached_blocks
Rebased on main to fix major merge conflicts after the test framework was moved out of zcash_client_sqlite.
I'm going to perform more rebases on this to clean up the commit history and break apart the larger changes as best I can, to make the PR easier to review and potentially break out smaller pieces of it into separate PRs.
Rebased on main to fix more merge conflicts.
Force-pushed to refactor the commits without any changes. In particular, I've pulled most of the async test changes out into a final commit, because I do not want the test framework to be async (at least at this stage), and we can instead use futures::executor::block_on wherever the test framework needs to use async functions (I haven't implemented this change yet but will do so).
I also plan to rebase this PR again once #1595 merges, to move away from the async-trait crate which I think will significantly simplify this PR.
Rebased on main to move away from the async-trait crate. I also did some more reworking of the commits to split them into logical changes. I almost have the test framework async-ness confined to the last commit; there is just one test in zcash_client_sqlite of FsBlockDb that needs adjusting.
The main next thing I want to figure out is whether the current state of the first commit can be paired down even further. BlockSource is made async in this PR, and I want to figure out whether that is necessary or not for the stated PR goal of implementing BlockCache for FsBlockDb.
Force-pushed to remove the dependency of BlockSource on data_api::chain::Error, and thus remove the similar complexity that this PR added to BlockCache.