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

impl ZcashIndexer for StateService #178

Merged
merged 14 commits into from
Feb 13, 2025
14 changes: 8 additions & 6 deletions zaino-state/src/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ mod tests {
.unwrap();

dbg!(recipient_balance.clone());
dbg!(fetch_service_balance.clone());
dbg!(fetch_service_balance);

assert_eq!(recipient_balance.transparent_balance.unwrap(), 250_000,);
assert_eq!(
Expand Down Expand Up @@ -1932,7 +1932,9 @@ mod tests {

dbg!(&fetch_service_mempool);
dbg!(&json_service_mempool);
assert_eq!(json_service_mempool.sort(), fetch_service_mempool.sort());
json_service_mempool.sort();
fetch_service_mempool.sort();
assert_eq!(json_service_mempool, fetch_service_mempool);

test_manager.close().await;
}
Expand Down Expand Up @@ -2547,13 +2549,13 @@ mod tests {
let mut sorted_fetch_mempool_tx = fetch_mempool_tx.clone();
sorted_fetch_mempool_tx.sort_by_key(|tx| tx.hash.clone());

let mut tx1_bytes = tx_1.first().as_ref().clone();
let mut tx1_bytes = *tx_1.first().as_ref();
tx1_bytes.reverse();
let mut tx2_bytes = tx_2.first().as_ref().clone();
let mut tx2_bytes = *tx_2.first().as_ref();
tx2_bytes.reverse();

let mut sorted_txids = vec![tx1_bytes, tx2_bytes];
sorted_txids.sort_by_key(|hash| hash.clone());
let mut sorted_txids = [tx1_bytes, tx2_bytes];
sorted_txids.sort_by_key(|hash| *hash);

assert_eq!(sorted_fetch_mempool_tx[0].hash, sorted_txids[0]);
assert_eq!(sorted_fetch_mempool_tx[1].hash, sorted_txids[1]);
Expand Down
8 changes: 4 additions & 4 deletions zaino-state/src/local_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ impl BlockCache {

/// Returns a [`BlockCacheSubscriber`].
pub fn subscriber(&self) -> BlockCacheSubscriber {
let finalised_state_subscriber = match &self.finalised_state {
Some(finalised_state) => Some(finalised_state.subscriber()),
None => None,
};
let finalised_state_subscriber = self
.finalised_state
.as_ref()
.map(FinalisedState::subscriber);
BlockCacheSubscriber {
fetcher: self.fetcher.clone(),
non_finalised_state: self.non_finalised_state.subscriber(),
Expand Down
Loading
Loading