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.
sourcepub fn sync(
&self,
confirmables: Vec<&(dyn Confirm + Sync + Send)>
) -> Result<(), TxSyncError>
pub fn sync( &self, confirmables: Vec<&(dyn Confirm + Sync + Send)> ) -> 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.
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.source§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