1//! Shared state reading code.
2//!
3//! Used by [`StateService`][1] and [`ReadStateService`][2] to read from the
4//! best [`Chain`][5] in the [`NonFinalizedState`][3], and the database in the
5//! [`FinalizedState`][4].
6//!
7//! [1]: service::StateService
8//! [2]: service::ReadStateService
9//! [3]: service::non_finalized_state::NonFinalizedState
10//! [4]: service::finalized_state::FinalizedState
11//! [5]: service::non_finalized_state::Chain
1213// Tidy up some doc links
14#[allow(unused_imports)]
15use crate::service;
1617pub mod address;
18pub mod block;
19pub mod difficulty;
20pub mod find;
21pub mod tree;
2223#[cfg(test)]
24mod tests;
2526pub use address::{
27 balance::transparent_balance,
28 tx_id::transparent_tx_ids,
29 utxo::{address_utxos, AddressUtxos},
30};
31pub use block::{
32 any_utxo, block, block_and_size, block_header, block_info, mined_transaction,
33 transaction_hashes_for_block, unspent_utxo,
34};
3536#[cfg(feature = "indexer")]
37pub use block::spending_transaction_hash;
3839pub use find::{
40 best_tip, block_locator, depth, finalized_state_contains_block_hash, find_chain_hashes,
41 find_chain_headers, hash_by_height, height_by_hash, next_median_time_past,
42 non_finalized_state_contains_block_hash, tip, tip_height, tip_with_value_balance,
43};
44pub use tree::{orchard_subtrees, orchard_tree, sapling_subtrees, sapling_tree};
4546#[cfg(any(test, feature = "proptest-impl"))]
47#[allow(unused_imports)]
48pub use address::utxo::ADDRESS_HEIGHTS_FULL_RANGE;
4950/// If a finalized state query is interrupted by a new finalized block,
51/// retry this many times.
52///
53/// Once we're at the tip, we expect up to 2 blocks to arrive at the same time.
54/// If any more arrive, the client should wait until we're synchronised with our peers.
55pub const FINALIZED_STATE_QUERY_RETRIES: usize = 3;