Skip to content

Commit

Permalink
implement 'read' for BlockDb so it can call 'scan_cached_blocks'
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar-Pepper authored and str4d committed Oct 28, 2024
1 parent 4c83f30 commit d8df635
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions zcash_client_sqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this library adheres to Rust's notion of
- wrapped `Connection` field in an arc mutex to implement `Sync` trait
- updated `with_blocks` to match changes to `BlockSource` trait
- added unimplemented `BlockCache` trait methods
- implemented `BlockCache::read` trait method
- `zcash_client_sqlite::FsBlockDb`:
- wrapped `conn` field in an arc mutex to implement `Sync` trait
- wrapped `blocks_dir` field in an arc to implement `Sync` trait
Expand Down
12 changes: 11 additions & 1 deletion zcash_client_sqlite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,17 @@ impl BlockCache for BlockDb {
&self,
range: &ScanRange,
) -> Result<Vec<CompactBlock>, data_api::chain::error::Error<WalletErrT, Self::Error>> {
todo!()
let mut compact_blocks = vec![];
self.with_blocks(
Some(range.block_range().start),
Some(range.len()),
|block| {
compact_blocks.push(block);
Ok(())
},
)
.await?;
Ok(compact_blocks)
}

async fn insert<WalletErrT>(
Expand Down

0 comments on commit d8df635

Please sign in to comment.