pub struct RpcBlockchainFactory {
    pub url: String,
    pub auth: Auth,
    pub network: Network,
    pub wallet_name_prefix: Option<String>,
    pub default_skip_blocks: u32,
    pub sync_params: Option<RpcSyncParams>,
}
Available on crate feature rpc only.
Expand description

Factory of RpcBlockchain instances, implements BlockchainFactory

Internally caches the node url and authentication params and allows getting many different RpcBlockchain objects for different wallet names and with different rescan heights.

Example

let factory = RpcBlockchainFactory {
    url: "http://127.0.0.1:18332".to_string(),
    auth: Auth::Cookie {
        file: "/home/user/.bitcoin/.cookie".into(),
    },
    network: Network::Testnet,
    wallet_name_prefix: Some("prefix-".to_string()),
    default_skip_blocks: 100_000,
    sync_params: None,
};
let main_wallet_blockchain = factory.build("main_wallet", Some(200_000))?;

Fields§

§url: String

The bitcoin node url

§auth: Auth

The bitcoin node authentication mechanism

§network: Network

The network we are using (it will be checked the bitcoin node network matches this)

§wallet_name_prefix: Option<String>

The optional prefix used to build the full wallet name for blockchains

§default_skip_blocks: u32

Default number of blocks to skip which will be inherited by blockchain unless overridden

§sync_params: Option<RpcSyncParams>

Sync parameters

Trait Implementations§

source§

impl BlockchainFactory for RpcBlockchainFactory

§

type Inner = RpcBlockchain

The type returned when building a blockchain from this factory
source§

fn build( &self, checksum: &str, _override_skip_blocks: Option<u32> ) -> Result<Self::Inner, Error>

Build a new blockchain for the given descriptor wallet_name Read more
source§

fn build_for_wallet<D: BatchDatabase>( &self, wallet: &Wallet<D>, override_skip_blocks: Option<u32> ) -> Result<Self::Inner, Error>

Build a new blockchain for a given wallet Read more
source§

fn sync_wallet<D: BatchDatabase>( &self, wallet: &Wallet<D>, override_skip_blocks: Option<u32>, sync_options: SyncOptions ) -> Result<(), Error>

Available on non-crate feature async-interface only.
Use BlockchainFactory::build_for_wallet to get a blockchain, then sync the wallet Read more
source§

impl Clone for RpcBlockchainFactory

source§

fn clone(&self) -> RpcBlockchainFactory

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RpcBlockchainFactory

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V