pub struct ElectrumSyncClient<L: Deref>{ /* private fields */ }
electrum
only.Expand description
Synchronizes LDK with a given Electrum server.
Needs to be registered with a ChainMonitor
via the Filter
interface to be informed of
transactions and outputs to monitor for on-chain confirmation, unconfirmation, and
reconfirmation.
Note that registration via Filter
needs to happen before any calls to
Watch::watch_channel
to ensure we get notified of the items to monitor.
Implementations§
Source§impl<L: Deref> ElectrumSyncClient<L>
impl<L: Deref> ElectrumSyncClient<L>
Sourcepub fn new(server_url: String, logger: L) -> Result<Self, TxSyncError>
pub fn new(server_url: String, logger: L) -> Result<Self, TxSyncError>
Returns a new ElectrumSyncClient
object.
Sourcepub fn from_client(
client: ElectrumClient,
logger: L,
) -> Result<Self, TxSyncError>
pub fn from_client( client: ElectrumClient, logger: L, ) -> Result<Self, TxSyncError>
Returns a new ElectrumSyncClient
object using the given Electrum client.
This is not exported to bindings users as the underlying client from BDK is not exported.
Sourcepub fn sync<C: Deref>(&self, confirmables: Vec<C>) -> Result<(), TxSyncError>
pub fn sync<C: Deref>(&self, confirmables: Vec<C>) -> Result<(), TxSyncError>
Synchronizes the given confirmables
via their Confirm
interface implementations. This
method should be called regularly to keep LDK up-to-date with current chain data.
For example, instances of ChannelManager
and ChainMonitor
can be informed about the
newest on-chain activity related to the items previously registered via the Filter
interface.
Sourcepub fn client(&self) -> &ElectrumClient
pub fn client(&self) -> &ElectrumClient
Returns a reference to the underlying Electrum client.
This is not exported to bindings users as the underlying client from BDK is not exported.
Trait Implementations§
Source§impl<L: Deref> Filter for ElectrumSyncClient<L>
impl<L: Deref> Filter for ElectrumSyncClient<L>
Source§fn register_tx(&self, txid: &Txid, _script_pubkey: &Script)
fn register_tx(&self, txid: &Txid, _script_pubkey: &Script)
txid
and having an output with script_pubkey
as
a spending condition. Read moreSource§fn register_output(&self, output: WatchedOutput)
fn register_output(&self, output: WatchedOutput)
Auto Trait Implementations§
impl<L> !Freeze for ElectrumSyncClient<L>
impl<L> RefUnwindSafe for ElectrumSyncClient<L>where
L: RefUnwindSafe,
impl<L> Send for ElectrumSyncClient<L>where
L: Send,
impl<L> Sync for ElectrumSyncClient<L>where
L: Sync,
impl<L> Unpin for ElectrumSyncClient<L>where
L: Unpin,
impl<L> UnwindSafe for ElectrumSyncClient<L>where
L: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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