breez_sdk_liquid::lightning_125::util::sweep

Struct OutputSweeper

pub struct OutputSweeper<B, D, E, F, K, L, O>{ /* private fields */ }
Expand description

A utility that keeps track of SpendableOutputDescriptors, persists them in a given KVStore and regularly retries sweeping them based on a callback given to the constructor methods.

Users should call Self::track_spendable_outputs for any SpendableOutputDescriptors received via Event::SpendableOutputs.

This needs to be notified of chain state changes either via its Listen or Confirm implementation and hence has to be connected with the utilized chain data sources.

If chain data is provided via the Confirm interface or via filtered blocks, users are required to give their chain data sources (i.e., Filter implementation) to the respective constructor.

Implementations§

§

impl<B, D, E, F, K, L, O> OutputSweeper<B, D, E, F, K, L, O>

pub fn new( best_block: BestBlock, broadcaster: B, fee_estimator: E, chain_data_source: Option<F>, output_spender: O, change_destination_source: D, kv_store: K, logger: L, ) -> OutputSweeper<B, D, E, F, K, L, O>

Constructs a new OutputSweeper.

If chain data is provided via the Confirm interface or via filtered blocks, users also need to register their Filter implementation via the given chain_data_source.

pub fn track_spendable_outputs( &self, output_descriptors: Vec<SpendableOutputDescriptor>, channel_id: Option<ChannelId>, exclude_static_outputs: bool, delay_until_height: Option<u32>, ) -> Result<(), ()>

Tells the sweeper to track the given outputs descriptors.

Usually, this should be called based on the values emitted by the Event::SpendableOutputs.

The given exclude_static_outputs flag controls whether the sweeper will filter out SpendableOutputDescriptor::StaticOutputs, which may be handled directly by the on-chain wallet implementation.

If delay_until_height is set, we will delay the spending until the respective block height is reached. This can be used to batch spends, e.g., to reduce on-chain fees.

Returns Err on persistence failure, in which case the call may be safely retried.

pub fn tracked_spendable_outputs(&self) -> Vec<TrackedSpendableOutput>

Returns a list of the currently tracked spendable outputs.

pub fn current_best_block(&self) -> BestBlock

Gets the latest best block which was connected either via the Listen or Confirm interfaces.

Trait Implementations§

§

impl<B, D, E, F, K, L, O> Confirm for OutputSweeper<B, D, E, F, K, L, O>

§

fn transactions_confirmed( &self, header: &Header, txdata: &[(usize, &Transaction)], height: u32, )

Notifies LDK of transactions confirmed in a block with a given header and height. Read more
§

fn transaction_unconfirmed(&self, txid: &Txid)

Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization. Read more
§

fn best_block_updated(&self, header: &Header, height: u32)

Notifies LDK of an update to the best header connected at the given height. Read more
§

fn get_relevant_txids(&self) -> Vec<(Txid, u32, Option<BlockHash>)>

Returns transactions that must be monitored for reorganization out of the chain along with the height and the hash of the block as part of which it had been previously confirmed. Read more
§

impl<B, D, E, F, K, L, O> Listen for OutputSweeper<B, D, E, F, K, L, O>

§

fn filtered_block_connected( &self, header: &Header, txdata: &[(usize, &Transaction)], height: u32, )

Notifies the listener that a block was added at the given height, with the transaction data possibly filtered.
§

fn block_disconnected(&self, header: &Header, height: u32)

Notifies the listener that a block was removed at the given height.
§

fn block_connected(&self, block: &Block, height: u32)

Notifies the listener that a block was added at the given height.
§

impl<B, D, E, F, K, L, O> ReadableArgs<(B, E, Option<F>, O, D, K, L)> for OutputSweeper<B, D, E, F, K, L, O>

§

fn read<R>( reader: &mut R, args: (B, E, Option<F>, O, D, K, L), ) -> Result<OutputSweeper<B, D, E, F, K, L, O>, DecodeError>
where R: Read,

Reads a Self in from the given Read.

Auto Trait Implementations§

§

impl<B, D, E, F, K, L, O> !Freeze for OutputSweeper<B, D, E, F, K, L, O>

§

impl<B, D, E, F, K, L, O> RefUnwindSafe for OutputSweeper<B, D, E, F, K, L, O>

§

impl<B, D, E, F, K, L, O> Send for OutputSweeper<B, D, E, F, K, L, O>
where B: Send, E: Send, O: Send, D: Send, K: Send, L: Send, F: Send,

§

impl<B, D, E, F, K, L, O> Sync for OutputSweeper<B, D, E, F, K, L, O>
where B: Sync, E: Sync, O: Sync, D: Sync, K: Sync, L: Sync, F: Sync,

§

impl<B, D, E, F, K, L, O> Unpin for OutputSweeper<B, D, E, F, K, L, O>
where B: Unpin, E: Unpin, O: Unpin, D: Unpin, K: Unpin, L: Unpin, F: Unpin,

§

impl<B, D, E, F, K, L, O> UnwindSafe for OutputSweeper<B, D, E, F, K, L, O>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DartSafe for T

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

§

impl<T> TaskRetFutTrait for T
where T: Send,