X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fbatteries%2FChannelManagerConstructor.java;h=4310af1cdc314f7c038def6befabca92d5b5a5a5;hb=d69a40d071871d3c0e4160744202c6e85941a4cc;hp=2a23d7186da3a5f53d8a9dbe3748f4367afac254;hpb=210577482a786c19f522f1fa99a928892c29fa0a;p=ldk-java diff --git a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java index 2a23d718..4310af1c 100644 --- a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java +++ b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java @@ -1,5 +1,6 @@ package org.ldk.batteries; +import org.jetbrains.annotations.Nullable; import org.ldk.enums.LDKNetwork; import org.ldk.structs.*; import org.ldk.util.TwoTuple; @@ -37,9 +38,11 @@ public class ChannelManagerConstructor { /** * Deserializes a channel manager and a set of channel monitors from the given serialized copies and interface implementations + * + * @param filter If provided, the outputs which were previously registered to be monitored for will be loaded into the filter. */ public ChannelManagerConstructor(byte[] channel_manager_serialized, byte[][] channel_monitors_serialized, - KeysInterface keys_interface, FeeEstimator fee_estimator, Watch chain_watch, + KeysInterface keys_interface, FeeEstimator fee_estimator, Watch chain_watch, @Nullable Filter filter, BroadcasterInterface tx_broadcaster, Logger logger) throws InvalidSerializedDataException { final ChannelMonitor[] monitors = new ChannelMonitor[channel_monitors_serialized.length]; this.channel_monitors = new TwoTuple[monitors.length]; @@ -60,6 +63,11 @@ public class ChannelManagerConstructor { this.channel_manager = ((Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_OK)res).res.b; this.channel_manager_latest_block_hash = ((Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_OK)res).res.a; this.chain_watch = chain_watch; + if (filter != null) { + for (ChannelMonitor monitor : monitors) { + monitor.load_outputs_to_watch(filter); + } + } } /** @@ -71,8 +79,7 @@ public class ChannelManagerConstructor { channel_monitors = new TwoTuple[0]; channel_manager_latest_block_hash = null; this.chain_watch = chain_watch; - // Note that current_blockchain_tip_hash will be required in a future version but is currently unused. - channel_manager = ChannelManager.constructor_new(network, fee_estimator, chain_watch, tx_broadcaster, logger, keys_interface, config, current_blockchain_tip_height); + channel_manager = ChannelManager.constructor_new(fee_estimator, chain_watch, tx_broadcaster, logger, keys_interface, config, network, current_blockchain_tip_hash, current_blockchain_tip_height); } /**