pub struct AddressCache<D: AddressCacheDatabase> { /* private fields */ }Expand description
Holds all addresses and associated transactions. We need a database with some basic methods, to store all data
Implementations§
Source§impl<D: AddressCacheDatabase> AddressCache<D>
impl<D: AddressCacheDatabase> AddressCache<D>
pub fn new(database: D) -> AddressCache<D>
pub fn get_utxo(&self, outpoint: &OutPoint) -> Option<TxOut>
pub fn n_cached_addresses(&self) -> usize
Sourcepub fn get_address_balance(&self, script_hash: &Hash) -> Option<u64>
pub fn get_address_balance(&self, script_hash: &Hash) -> Option<u64>
Returns the balance of this address, debts (spends) are taken in account
pub fn get_cached_addresses(&self) -> Vec<ScriptBuf>
pub fn bump_height(&self, height: u32)
pub fn get_cache_height(&self) -> u32
Sourcepub fn is_cached(&self, desc: &String) -> Result<bool, WatchOnlyError<D::Error>>
pub fn is_cached(&self, desc: &String) -> Result<bool, WatchOnlyError<D::Error>>
Tells whether or not a descriptor is already cached
Sourcepub fn is_address_cached(&self, script_hash: &Hash) -> bool
pub fn is_address_cached(&self, script_hash: &Hash) -> bool
Tells whether an address is already cached
pub fn push_descriptor( &self, descriptor: &str, ) -> Result<(), WatchOnlyError<D::Error>>
pub fn get_position(&self, txid: &Txid) -> Option<u32>
pub fn get_height(&self, txid: &Txid) -> Option<u32>
pub fn get_cached_transaction(&self, txid: &Txid) -> Option<String>
pub fn setup(&self) -> Result<(), WatchOnlyError<D::Error>>
pub fn block_process( &self, block: &Block, height: u32, ) -> Vec<(Transaction, TxOut)>
pub fn get_address_utxos( &self, script_hash: &Hash, ) -> Option<Vec<(TxOut, OutPoint)>>
pub fn get_transaction(&self, txid: &Txid) -> Option<CachedTransaction>
pub fn get_address_history( &self, script_hash: &Hash, ) -> Option<Vec<CachedTransaction>>
Sourcepub fn get_merkle_proof(&self, txid: &Txid) -> Option<MerkleProof>
pub fn get_merkle_proof(&self, txid: &Txid) -> Option<MerkleProof>
Returns the Merkle Proof for a given txid.
Fails if a given Txid is an unconfirmed transaction.
pub fn derive_addresses(&self) -> Result<(), WatchOnlyError<D::Error>>
pub fn get_stats(&self) -> Result<Stats, WatchOnlyError<D::Error>>
pub fn maybe_derive_addresses(&self)
pub fn find_unconfirmed( &self, ) -> Result<Vec<Transaction>, WatchOnlyError<D::Error>>
pub fn cache_address(&self, script_pk: ScriptBuf)
pub fn cache_mempool_transaction(&self, transaction: &Transaction) -> Vec<TxOut>
pub fn save_mempool_tx( &self, hash: Hash, transaction_to_cache: CachedTransaction, )
pub fn save_non_mempool_tx( &self, transaction: &Transaction, is_spend: bool, value: u64, index: usize, hash: Hash, transaction_to_cache: CachedTransaction, )
pub fn get_descriptors(&self) -> Result<Vec<String>, WatchOnlyError<D::Error>>
pub fn cache_transaction( &self, transaction: &Transaction, height: u32, value: u64, merkle_block: MerkleProof, position: u32, index: usize, is_spend: bool, hash: Hash, )
Trait Implementations§
Source§impl<D: AddressCacheDatabase + Sync + Send + 'static> BlockConsumer for AddressCache<D>
impl<D: AddressCacheDatabase + Sync + Send + 'static> BlockConsumer for AddressCache<D>
fn consume_block(&self, block: &Block, height: u32)
Auto Trait Implementations§
impl<D> !Freeze for AddressCache<D>
impl<D> RefUnwindSafe for AddressCache<D>
impl<D> Send for AddressCache<D>where
D: Send,
impl<D> Sync for AddressCache<D>
impl<D> Unpin for AddressCache<D>where
D: Unpin,
impl<D> UnwindSafe for AddressCache<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more