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>

source

pub fn new(database: D) -> AddressCache<D>

source

pub fn get_utxo(&self, outpoint: &OutPoint) -> Option<TxOut>

source

pub fn n_cached_addresses(&self) -> usize

source

pub fn get_address_balance(&self, script_hash: &Hash) -> Option<u64>

Returns the balance of this address, debts (spends) are taken in account

source

pub fn get_cached_addresses(&self) -> Vec<ScriptBuf>

source

pub fn bump_height(&self, height: u32)

source

pub fn get_cache_height(&self) -> u32

source

pub fn is_cached(&self, desc: &String) -> Result<bool, WatchOnlyError<D::Error>>

Tells whether or not a descriptor is already cached

source

pub fn is_address_cached(&self, script_hash: &Hash) -> bool

Tells wheter an address is already cached

source

pub fn push_descriptor( &self, descriptor: &str ) -> Result<(), WatchOnlyError<D::Error>>

source

pub fn get_position(&self, txid: &Txid) -> Option<u32>

source

pub fn get_height(&self, txid: &Txid) -> Option<u32>

source

pub fn get_cached_transaction(&self, txid: &Txid) -> Option<String>

source

pub fn setup(&self) -> Result<(), WatchOnlyError<D::Error>>

source

pub fn block_process( &self, block: &Block, height: u32 ) -> Vec<(Transaction, TxOut)>

source

pub fn get_address_utxos( &self, script_hash: &Hash ) -> Option<Vec<(TxOut, OutPoint)>>

source

pub fn get_transaction(&self, txid: &Txid) -> Option<CachedTransaction>

source

pub fn get_address_history( &self, script_hash: &Hash ) -> Option<Vec<CachedTransaction>>

source

pub fn get_merkle_proof(&self, txid: &Txid) -> Option<(Vec<String>, u32)>

source

pub fn derive_addresses(&self) -> Result<(), WatchOnlyError<D::Error>>

source

pub fn get_stats(&self) -> Result<Stats, WatchOnlyError<D::Error>>

source

pub fn maybe_derive_addresses(&self)

source

pub fn find_unconfirmed( &self ) -> Result<Vec<Transaction>, WatchOnlyError<D::Error>>

source

pub fn cache_address(&self, script_pk: ScriptBuf)

source

pub fn cache_mempool_transaction(&self, transaction: &Transaction) -> Vec<TxOut>

source

pub fn save_mempool_tx( &self, hash: Hash, transaction_to_cache: CachedTransaction )

source

pub fn save_non_mempool_tx( &self, transaction: &Transaction, is_spend: bool, value: u64, index: usize, hash: Hash, transaction_to_cache: CachedTransaction )

source

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>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.