Package org.ldk.structs
Class ChannelManagerReadArgs
- java.lang.Object
-
- org.ldk.structs.ChannelManagerReadArgs
-
public class ChannelManagerReadArgs extends Object
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 [`ChannelMonitor`]s. 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 [`ChannelMonitor`]s. 5) Disconnect/connect blocks on the [`ChannelManager`]. 6) Re-persist the [`ChannelMonitor`]s 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 [`ChannelMonitor`]s 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. [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
Watch
get_chain_monitor()
The chain::Watch for use in the ChannelManager in the future.UserConfig
get_default_config()
Default settings used for new channels.EntropySource
get_entropy_source()
A cryptographically secure source of entropy.FeeEstimator
get_fee_estimator()
The fee_estimator for use in the ChannelManager in the future.Logger
get_logger()
The Logger for use in the ChannelManager and which may be used to log information during deserialization.NodeSigner
get_node_signer()
A signer that is able to perform node-scoped cryptographic operations.Router
get_router()
The router which will be used in the ChannelManager in the future for finding routes on-the-fly for trampoline payments.SignerProvider
get_signer_provider()
The keys provider which will give us relevant keys.BroadcasterInterface
get_tx_broadcaster()
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.static ChannelManagerReadArgs
of(EntropySource entropy_source, NodeSigner node_signer, SignerProvider signer_provider, FeeEstimator fee_estimator, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Router router, Logger logger, UserConfig default_config, ChannelMonitor[] channel_monitors)
Simple utility function to create a ChannelManagerReadArgs which creates the monitor HashMap for you.void
set_chain_monitor(Watch val)
The chain::Watch for use in the ChannelManager in the future.void
set_default_config(UserConfig val)
Default settings used for new channels.void
set_entropy_source(EntropySource val)
A cryptographically secure source of entropy.void
set_fee_estimator(FeeEstimator val)
The fee_estimator for use in the ChannelManager in the future.void
set_logger(Logger val)
The Logger for use in the ChannelManager and which may be used to log information during deserialization.void
set_node_signer(NodeSigner val)
A signer that is able to perform node-scoped cryptographic operations.void
set_router(Router val)
The router which will be used in the ChannelManager in the future for finding routes on-the-fly for trampoline payments.void
set_signer_provider(SignerProvider val)
The keys provider which will give us relevant keys.void
set_tx_broadcaster(BroadcasterInterface val)
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.
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
get_entropy_source
public EntropySource get_entropy_source()
A cryptographically secure source of entropy.
-
set_entropy_source
public void set_entropy_source(EntropySource val)
A cryptographically secure source of entropy.
-
get_node_signer
public NodeSigner get_node_signer()
A signer that is able to perform node-scoped cryptographic operations.
-
set_node_signer
public void set_node_signer(NodeSigner val)
A signer that is able to perform node-scoped cryptographic operations.
-
get_signer_provider
public SignerProvider get_signer_provider()
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.
-
set_signer_provider
public void set_signer_provider(SignerProvider val)
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.
-
get_fee_estimator
public FeeEstimator get_fee_estimator()
The fee_estimator for use in the ChannelManager in the future. No calls to the FeeEstimator will be made during deserialization.
-
set_fee_estimator
public void set_fee_estimator(FeeEstimator val)
The fee_estimator for use in the ChannelManager in the future. No calls to the FeeEstimator will be made during deserialization.
-
get_chain_monitor
public Watch get_chain_monitor()
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.
-
set_chain_monitor
public void set_chain_monitor(Watch val)
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.
-
get_tx_broadcaster
public BroadcasterInterface get_tx_broadcaster()
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.
-
set_tx_broadcaster
public void set_tx_broadcaster(BroadcasterInterface val)
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.
-
get_router
public Router get_router()
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.
-
set_router
public void set_router(Router val)
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.
-
get_logger
public Logger get_logger()
The Logger for use in the ChannelManager and which may be used to log information during deserialization.
-
set_logger
public void set_logger(Logger val)
The Logger for use in the ChannelManager and which may be used to log information during deserialization.
-
get_default_config
public UserConfig get_default_config()
Default settings used for new channels. Any existing channels will continue to use the runtime settings which were stored when the ChannelManager was serialized.
-
set_default_config
public void set_default_config(UserConfig val)
Default settings used for new channels. Any existing channels will continue to use the runtime settings which were stored when the ChannelManager was serialized.
-
of
public static ChannelManagerReadArgs of(EntropySource entropy_source, NodeSigner node_signer, SignerProvider signer_provider, FeeEstimator fee_estimator, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Router router, Logger logger, UserConfig default_config, ChannelMonitor[] channel_monitors)
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.
-
-