Struct floresta_watch_only::AddressCache
source · 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 wheter 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>>
pub fn get_merkle_proof(&self, txid: &Txid) -> Option<(Vec<String>, u32)>
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 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> RefUnwindSafe for AddressCache<D>
impl<D> Send for AddressCache<D>where D: Send,
impl<D> Sync for AddressCache<D>where D: Send + Sync,
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