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.