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 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) Move the ChannelMonitors into your local chain::Watch. Note that the ordering of #4-6 is not of importance, however all three 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.
-
-
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.FeeEstimator
get_fee_estimator()
The fee_estimator for use in the ChannelManager in the future.KeysInterface
get_keys_manager()
The keys provider which will give us relevant keys.Logger
get_logger()
The Logger for use in the ChannelManager and which may be used to log information during deserialization.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(KeysInterface keys_manager, FeeEstimator fee_estimator, Watch chain_monitor, BroadcasterInterface tx_broadcaster, 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_fee_estimator(FeeEstimator val)
The fee_estimator for use in the ChannelManager in the future.void
set_keys_manager(KeysInterface val)
The keys provider which will give us relevant keys.void
set_logger(Logger val)
The Logger for use in the ChannelManager and which may be used to log information during deserialization.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_keys_manager
public KeysInterface get_keys_manager()
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_keys_manager
public void set_keys_manager(KeysInterface 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_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(KeysInterface keys_manager, FeeEstimator fee_estimator, Watch chain_monitor, BroadcasterInterface tx_broadcaster, 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.
-
-