Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BlockCache trait for FsBlockDb #1535

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Oscar-Pepper
Copy link
Contributor

@Oscar-Pepper Oscar-Pepper commented Sep 11, 2024

  • 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::read for BlockDb, neccessary for calling scan_cached_blocks

@Oscar-Pepper Oscar-Pepper marked this pull request as ready for review September 11, 2024 15:57
@Oscar-Pepper Oscar-Pepper marked this pull request as draft September 11, 2024 15:58
@Oscar-Pepper Oscar-Pepper marked this pull request as ready for review September 12, 2024 09:06
async fn read<WalletErrT>(
&self,
range: &ScanRange,
) -> Result<Vec<CompactBlock>, error::Error<WalletErrT, Self::Error>>;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that is happening on the BlockSource trait as well, but both BlockSource and BlockCache traits have nothing to do with the Wallet, so it's leaky and weird to have to parameterize methods on these traits based on the Wallet (more specifically what errors the Wallet throws).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants