breez_sdk_liquid::lightning::ln::channelmanager

Struct ChannelManagerReadArgs

pub struct ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>
where M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref, <M as Deref>::Target: Watch<<<SP as Deref>::Target as SignerProvider>::Signer>, <T as Deref>::Target: BroadcasterInterface, <ES as Deref>::Target: EntropySource, <NS as Deref>::Target: NodeSigner, <SP as Deref>::Target: SignerProvider, <F as Deref>::Target: FeeEstimator, <R as Deref>::Target: Router, <L as Deref>::Target: Logger,
{ pub entropy_source: ES, pub node_signer: NS, pub signer_provider: SP, pub fee_estimator: F, pub chain_monitor: M, pub tx_broadcaster: T, pub router: R, pub logger: L, pub default_config: UserConfig, pub channel_monitors: HashMap<OutPoint, &'a mut ChannelMonitor<<<SP as Deref>::Target as SignerProvider>::Signer>>, }
Expand description

Arguments for the creation of a ChannelManager that are not deserialized.

At a high-level, the process for deserializing a ChannelManager and resuming normal operation is:

  1. Deserialize all stored ChannelMonitors.
  2. Deserialize the ChannelManager by filling in this struct and calling: <(BlockHash, ChannelManager)>::read(reader, args) This may result in closing some channels if the ChannelMonitor is newer than the stored ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
  3. If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same way you would handle a chain::Filter call using ChannelMonitor::get_outputs_to_watch and ChannelMonitor::get_funding_txo.
  4. Reconnect blocks on your ChannelMonitors.
  5. Disconnect/connect blocks on the ChannelManager.
  6. Re-persist the ChannelMonitors to ensure the latest state is on disk. Note that if you’re using a ChainMonitor for your chain::Watch implementation, you will likely accomplish this as a side-effect of calling chain::Watch::watch_channel in the next step.
  7. Move the ChannelMonitors into your local chain::Watch. If you’re using a ChainMonitor, this is done by calling chain::Watch::watch_channel.

Note that the ordering of #4-7 is not of importance, however all four must occur before you call any other methods on the newly-deserialized ChannelManager.

Note that because some channels may be closed during deserialization, it is critical that you always deserialize only the latest version of a ChannelManager and ChannelMonitors available to you. If you deserialize an old ChannelManager (during which force-closure transactions may be broadcast), and then later deserialize a newer version of the same ChannelManager (which will not force-close the same channels but consider them live), you may end up revoking a state for which you’ve already broadcasted the transaction.

Fields§

§entropy_source: ES

A cryptographically secure source of entropy.

§node_signer: NS

A signer that is able to perform node-scoped cryptographic operations.

§signer_provider: SP

The keys provider which will give us relevant keys. Some keys will be loaded during deserialization and KeysInterface::read_chan_signer will be used to read per-Channel signing data.

§fee_estimator: F

The fee_estimator for use in the ChannelManager in the future.

No calls to the FeeEstimator will be made during deserialization.

§chain_monitor: M

The chain::Watch for use in the ChannelManager in the future.

No calls to the chain::Watch will be made during deserialization. It is assumed that you have deserialized ChannelMonitors separately and will add them to your chain::Watch after deserializing this ChannelManager.

§tx_broadcaster: T

The BroadcasterInterface which will be used in the ChannelManager in the future and may be used to broadcast the latest local commitment transactions of channels which must be force-closed during deserialization.

§router: R

The router which will be used in the ChannelManager in the future for finding routes on-the-fly for trampoline payments. Absent in private nodes that don’t support forwarding.

No calls to the router will be made during deserialization.

§logger: L

The Logger for use in the ChannelManager and which may be used to log information during deserialization.

§default_config: UserConfig

Default settings used for new channels. Any existing channels will continue to use the runtime settings which were stored when the ChannelManager was serialized.

§channel_monitors: HashMap<OutPoint, &'a mut ChannelMonitor<<<SP as Deref>::Target as SignerProvider>::Signer>>

A map from channel funding outpoints to ChannelMonitors for those channels (ie value.context.get_funding_txo() should be the key).

If a monitor is inconsistent with the channel state during deserialization the channel will be force-closed using the data in the ChannelMonitor and the channel will be dropped. This is true for missing channels as well. If there is a monitor missing for which we find channel data Err(DecodeError::InvalidValue) will be returned.

In such cases the latest local transactions will be sent to the tx_broadcaster included in this struct.

This is not exported to bindings users because we have no HashMap bindings

Implementations§

§

impl<'a, M, T, ES, NS, SP, F, R, L> ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>
where M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref, <M as Deref>::Target: Watch<<<SP as Deref>::Target as SignerProvider>::Signer>, <T as Deref>::Target: BroadcasterInterface, <ES as Deref>::Target: EntropySource, <NS as Deref>::Target: NodeSigner, <SP as Deref>::Target: SignerProvider, <F as Deref>::Target: FeeEstimator, <R as Deref>::Target: Router, <L as Deref>::Target: Logger,

pub fn new( entropy_source: ES, node_signer: NS, signer_provider: SP, fee_estimator: F, chain_monitor: M, tx_broadcaster: T, router: R, logger: L, default_config: UserConfig, channel_monitors: Vec<&'a mut ChannelMonitor<<<SP as Deref>::Target as SignerProvider>::Signer>>, ) -> ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>

Simple utility function to create a ChannelManagerReadArgs which creates the monitor HashMap for you. This is primarily useful for C bindings where it is not practical to populate a HashMap directly from C.

Trait Implementations§

§

impl<'a, M, T, ES, NS, SP, F, R, L> ReadableArgs<ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>> for (BlockHash, Arc<ChannelManager<M, T, ES, NS, SP, F, R, L>>)
where M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref, <M as Deref>::Target: Watch<<<SP as Deref>::Target as SignerProvider>::Signer>, <T as Deref>::Target: BroadcasterInterface, <ES as Deref>::Target: EntropySource, <NS as Deref>::Target: NodeSigner, <SP as Deref>::Target: SignerProvider, <F as Deref>::Target: FeeEstimator, <R as Deref>::Target: Router, <L as Deref>::Target: Logger,

§

fn read<Reader>( reader: &mut Reader, args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>, ) -> Result<(BlockHash, Arc<ChannelManager<M, T, ES, NS, SP, F, R, L>>), DecodeError>
where Reader: Read,

Reads a Self in from the given Read.
§

impl<'a, M, T, ES, NS, SP, F, R, L> ReadableArgs<ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>> for (BlockHash, ChannelManager<M, T, ES, NS, SP, F, R, L>)
where M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref, <M as Deref>::Target: Watch<<<SP as Deref>::Target as SignerProvider>::Signer>, <T as Deref>::Target: BroadcasterInterface, <ES as Deref>::Target: EntropySource, <NS as Deref>::Target: NodeSigner, <SP as Deref>::Target: SignerProvider, <F as Deref>::Target: FeeEstimator, <R as Deref>::Target: Router, <L as Deref>::Target: Logger,

§

fn read<Reader>( reader: &mut Reader, args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>, ) -> Result<(BlockHash, ChannelManager<M, T, ES, NS, SP, F, R, L>), DecodeError>
where Reader: Read,

Reads a Self in from the given Read.

Auto Trait Implementations§

§

impl<'a, M, T, ES, NS, SP, F, R, L> Freeze for ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>
where ES: Freeze, NS: Freeze, SP: Freeze, F: Freeze, M: Freeze, T: Freeze, R: Freeze, L: Freeze,

§

impl<'a, M, T, ES, NS, SP, F, R, L> RefUnwindSafe for ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>

§

impl<'a, M, T, ES, NS, SP, F, R, L> Send for ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>
where ES: Send, NS: Send, SP: Send, F: Send, M: Send, T: Send, R: Send, L: Send, <<SP as Deref>::Target as SignerProvider>::Signer: Send,

§

impl<'a, M, T, ES, NS, SP, F, R, L> Sync for ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>
where ES: Sync, NS: Sync, SP: Sync, F: Sync, M: Sync, T: Sync, R: Sync, L: Sync, <<SP as Deref>::Target as SignerProvider>::Signer: Send,

§

impl<'a, M, T, ES, NS, SP, F, R, L> Unpin for ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>
where ES: Unpin, NS: Unpin, SP: Unpin, F: Unpin, M: Unpin, T: Unpin, R: Unpin, L: Unpin,

§

impl<'a, M, T, ES, NS, SP, F, R, L> !UnwindSafe for ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>

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> 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> TaskRetFutTrait for T
where T: Send,