Skip to content

Commit

Permalink
Uses range_iter in address_transaction_locations
Browse files Browse the repository at this point in the history
  • Loading branch information
arya2 committed Oct 11, 2023
1 parent 0cffae5 commit 581829d
Showing 1 changed file with 11 additions and 31 deletions.
42 changes: 11 additions & 31 deletions zebra-state/src/service/finalized_state/zebra_db/transparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,44 +235,24 @@ impl ZebraDb {
let tx_loc_by_transparent_addr_loc =
self.db.cf_handle("tx_loc_by_transparent_addr_loc").unwrap();

// Manually fetch the entire addresses' transaction locations
let mut addr_transactions = BTreeSet::new();

// A potentially invalid key representing the first UTXO send to the address,
// or the query start height.
let mut transaction_location = AddressTransaction::address_iterator_start(
let transaction_location = AddressTransaction::address_iterator_start(
address_location,
*query_height_range.start(),
);

loop {
// Seek to a valid entry for this address, or the first entry for the next address
transaction_location = match self
.db
.zs_next_key_value_from(&tx_loc_by_transparent_addr_loc, &transaction_location)
{
Some((transaction_location, ())) => transaction_location,
// We're finished with the final address in the column family
None => break,
};

// We found the next address, so we're finished with this address
if transaction_location.address_location() != address_location {
break;
}

// We're past the end height, so we're finished with this query
if transaction_location.transaction_location().height > *query_height_range.end() {
break;
}

addr_transactions.insert(transaction_location);

// A potentially invalid key representing the next possible output
transaction_location.address_iterator_next();
}
let last_transaction_location = AddressTransaction::new(
address_location,
TransactionLocation::from_usize(*query_height_range.end(), usize::MAX),
);

addr_transactions
self.zs_range_iter(

Check failure on line 250 in zebra-state/src/service/finalized_state/zebra_db/transparent.rs

View workflow job for this annotation

GitHub Actions / Install zebrad from lockfile without cache on ubuntu-latest

no method named `zs_range_iter` found for reference `&ZebraDb` in the current scope

Check failure on line 250 in zebra-state/src/service/finalized_state/zebra_db/transparent.rs

View workflow job for this annotation

GitHub Actions / Build zebra-state crate

no method named `zs_range_iter` found for reference `&ZebraDb` in the current scope
&tx_loc_by_transparent_addr_loc,
&transaction_location..=&last_transaction_location,
)
.map(|(tx_loc, ())| tx_loc)
.collect()
}

// Address index queries
Expand Down

0 comments on commit 581829d

Please sign in to comment.