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 26, 2024
1 parent a52e8fa commit 5b3fade
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions zcash_client_sqlite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,7 @@ impl BlockSource for BlockDb {
}
}

#[async_trait::async_trait]
impl BlockCache for BlockDb {
fn get_tip_height<'life0, 'life1, 'async_trait, WalletErrT>(
&'life0 self,
Expand All @@ -1675,27 +1676,21 @@ impl BlockCache for BlockDb {
todo!()
}

fn read<'life0, 'life1, 'async_trait, WalletErrT>(
&'life0 self,
_range: &'life1 ScanRange,
) -> core::pin::Pin<
Box<
dyn core::future::Future<
Output = Result<
Vec<CompactBlock>,
data_api::chain::error::Error<WalletErrT, Self::Error>,
>,
> + core::marker::Send
+ 'async_trait,
>,
>
where
WalletErrT: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
{
todo!()
async fn read<WalletErrT>(
&self,
range: &ScanRange,
) -> Result<Vec<CompactBlock>, data_api::chain::error::Error<WalletErrT, Self::Error>> {
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)
}

fn insert<'life0, 'async_trait, WalletErrT>(
Expand Down

0 comments on commit 5b3fade

Please sign in to comment.