X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fbatteries%2FChannelManagerConstructor.java;h=0d2055b21a860c478ee4fee2f93a150aeb0bb6b7;hb=6ed64cdd6f81d4ab65f37755fcaa5325ca61425f;hp=f8e3484b7e0b7b74779833f2a1e232a79dd13adc;hpb=a8d80c689a0a67145d4992ea96cdc4acdc6f954d;p=ldk-java diff --git a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java index f8e3484b..0d2055b2 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,13 @@ 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. + * Note that if the provided Watch is a ChainWatch and has an associated filter, the previously registered + * outputs will be loaded when chain_sync_completed is called. */ 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 +65,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); + } + } } /**