Skip to content

Commit

Permalink
update references to renamed method
Browse files Browse the repository at this point in the history
  • Loading branch information
arya2 committed Mar 23, 2023
1 parent 9674ccb commit 0a4d47b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions zebra-state/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ impl StateService {
/// Returns true if the block hash is queued or has been sent to be validated and committed.
/// Returns false otherwise.
fn is_block_queued(&self, hash: &block::Hash) -> bool {
self.queued_non_finalized_blocks.contains(hash)
self.queued_non_finalized_blocks.contains_block_hash(hash)
|| self.queued_finalized_blocks.contains_key(hash)
|| self.sent_blocks.contains(hash)
}
Expand Down Expand Up @@ -1082,12 +1082,12 @@ impl Service<Request> for StateService {
let read_service = self.read_service.clone();

async move {
let response = read::non_finalized_state_contains_hash(
let response = read::non_finalized_state_contains_block_hash(
&read_service.latest_non_finalized_state(),
hash,
)
.or(is_block_queued.then_some(KnownBlock::Queue))
.or_else(|| read::finalized_state_contains_hash(&read_service.db, hash));
.or_else(|| read::finalized_state_contains_block_hash(&read_service.db, hash));

// The work is done in the future.
timer.finish(module_path!(), line!(), "Request::KnownBlock");
Expand Down
4 changes: 2 additions & 2 deletions zebra-state/src/service/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ pub use block::{
any_utxo, block, block_header, transaction, transaction_hashes_for_block, unspent_utxo, utxo,
};
pub use find::{
best_tip, block_locator, chain_contains_hash, depth, finalized_state_contains_hash,
best_tip, block_locator, chain_contains_hash, depth, finalized_state_contains_block_hash,
find_chain_hashes, find_chain_headers, hash_by_height, height_by_hash, next_median_time_past,
non_finalized_state_contains_hash, tip, tip_height,
non_finalized_state_contains_block_hash, tip, tip_height,
};
pub use tree::{orchard_tree, sapling_tree};

Expand Down
6 changes: 3 additions & 3 deletions zebra-state/src/service/read/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ where

/// Returns the location of the block if present in the non-finalized state.
/// Returns None if the block hash is not found in the non-finalized state.
pub fn non_finalized_state_contains_hash(
pub fn non_finalized_state_contains_block_hash(
non_finalized_state: &NonFinalizedState,
hash: block::Hash,
) -> Option<KnownBlock> {
let mut chains_iter = non_finalized_state.chain_set.iter().rev();
let is_hash_in_chain = |chain: &Arc<Chain>| chain.contains(&hash);
let is_hash_in_chain = |chain: &Arc<Chain>| chain.contains_block_hash(&hash);

// Equivalent to `chain_set.iter().next_back()` in `NonFinalizedState.best_chain()` method.
let best_chain = chains_iter.next();
Expand All @@ -122,7 +122,7 @@ pub fn non_finalized_state_contains_hash(

/// Returns the location of the block if present in the finalized state.
/// Returns None if the block hash is not found in the finalized state.
pub fn finalized_state_contains_hash(db: &ZebraDb, hash: block::Hash) -> Option<KnownBlock> {
pub fn finalized_state_contains_block_hash(db: &ZebraDb, hash: block::Hash) -> Option<KnownBlock> {
db.contains_hash(hash).then_some(KnownBlock::BestChain)
}

Expand Down

0 comments on commit 0a4d47b

Please sign in to comment.