Skip to content

Commit

Permalink
change some storage methods
Browse files Browse the repository at this point in the history
  • Loading branch information
oxarbitrage committed Nov 15, 2023
1 parent a0d981f commit 2bda6f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions zebra-scan/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ impl Storage {
}

/// Get the results of a sapling key.
pub fn get_sapling_results(&self, key: &str) -> Option<&Vec<Hash>> {
self.sapling_results.get(key)
pub fn get_sapling_results(&self, key: &str) -> Vec<Hash> {
self.sapling_results.get(key).cloned().unwrap_or_default()
}

/// Get all sapling keys.
pub fn get_sapling_keys(&self) -> Vec<SaplingScanningKey> {
self.sapling_keys.keys().cloned().collect()
/// Get all keys and their birthdays.
pub fn get_sapling_keys(&self) -> HashMap<String, Option<Height>> {
self.sapling_keys.clone()
}
}
4 changes: 2 additions & 2 deletions zebra-scan/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ async fn scanning_fake_blocks_store_key_and_results() -> Result<()> {

// Check key was added
assert_eq!(s.get_sapling_keys().len(), 1);
assert_eq!(s.get_sapling_keys()[0], key_to_be_stored.clone());
assert_eq!(s.get_sapling_keys().get(&key_to_be_stored), Some(&None));

let vks: Vec<(&AccountId, &SaplingIvk)> = vec![];
let nf = Nullifier([7; 32]);
Expand Down Expand Up @@ -340,7 +340,7 @@ async fn scanning_fake_blocks_store_key_and_results() -> Result<()> {

// Check the result was added
assert_eq!(
s.get_sapling_results(key_to_be_stored.as_str()).unwrap()[0],
s.get_sapling_results(key_to_be_stored.as_str())[0],
found_transaction_hash
);

Expand Down

0 comments on commit 2bda6f9

Please sign in to comment.