]> git.bitcoin.ninja Git - ldk-java/commitdiff
Allow users to specify a `UserConfig` when de-ser'ing a ChanManager
authorMatt Corallo <git@bluematt.me>
Thu, 11 Nov 2021 17:43:44 +0000 (17:43 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 25 Nov 2021 14:52:00 +0000 (14:52 +0000)
Fixes #55.

src/main/java/org/ldk/batteries/ChannelManagerConstructor.java
src/test/java/org/ldk/HumanObjectPeerTest.java

index 0e68a947141c9ed3a1bab449816cdab77f20d4f8..3dd5f49f65b882e3ea3fab98cb3ef53697465125 100644 (file)
@@ -68,9 +68,9 @@ public class ChannelManagerConstructor {
      *               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, ChainMonitor chain_monitor, @Nullable Filter filter,
-                                     @Nullable NetworkGraph net_graph,
+    public ChannelManagerConstructor(byte[] channel_manager_serialized, byte[][] channel_monitors_serialized, UserConfig config,
+                                     KeysInterface keys_interface, FeeEstimator fee_estimator, ChainMonitor chain_monitor,
+                                     @Nullable Filter filter, @Nullable NetworkGraph net_graph,
                                      BroadcasterInterface tx_broadcaster, Logger logger) throws InvalidSerializedDataException {
         final IgnoringMessageHandler no_custom_messages = IgnoringMessageHandler.of();
         final ChannelMonitor[] monitors = new ChannelMonitor[channel_monitors_serialized.length];
@@ -86,7 +86,7 @@ public class ChannelManagerConstructor {
         }
         Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ res =
                 UtilMethods.C2Tuple_BlockHashChannelManagerZ_read(channel_manager_serialized, keys_interface, fee_estimator, chain_monitor.as_Watch(), tx_broadcaster,
-                        logger, UserConfig.with_default(), monitors);
+                        logger, config, monitors);
         if (res instanceof Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_Err) {
             throw new InvalidSerializedDataException();
         }
index b51df8429cb17c3c2befa3a1cceaa8d0ab33ed3f..eb3d43f2d08667770461f0081d330608c97129c9 100644 (file)
@@ -404,11 +404,13 @@ class HumanObjectPeerTestInstance {
                         filter_nullable = ((Option_FilterZ.Some) this.filter).some;
                     }
                     if (use_ignore_handler) {
-                        this.constructor = new ChannelManagerConstructor(serialized, monitors, this.keys_interface,
-                                this.fee_estimator, this.chain_monitor, filter_nullable, null, this.tx_broadcaster, this.logger);
+                        this.constructor = new ChannelManagerConstructor(serialized, monitors, UserConfig.with_default(),
+                                this.keys_interface, this.fee_estimator, this.chain_monitor, filter_nullable,
+                                null, this.tx_broadcaster, this.logger);
                     } else {
-                        this.constructor = new ChannelManagerConstructor(serialized, monitors, this.keys_interface,
-                                this.fee_estimator, this.chain_monitor, filter_nullable, this.router, this.tx_broadcaster, this.logger);
+                        this.constructor = new ChannelManagerConstructor(serialized, monitors, UserConfig.with_default(),
+                                this.keys_interface, this.fee_estimator, this.chain_monitor, filter_nullable,
+                                this.router, this.tx_broadcaster, this.logger);
                     }
                     LockableScore scorer = null;
                     if (use_invoice_payer) { scorer = LockableScore.of(Scorer.with_default().as_Score()); }