From: Matt Corallo Date: Thu, 11 Nov 2021 17:43:44 +0000 (+0000) Subject: Allow users to specify a `UserConfig` when de-ser'ing a ChanManager X-Git-Tag: v0.0.103.1^2~15 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=eea000e2763b9313b4fe184e9552764a0c5d606d;p=ldk-java Allow users to specify a `UserConfig` when de-ser'ing a ChanManager Fixes #55. --- diff --git a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java index 0e68a947..3dd5f49f 100644 --- a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java +++ b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java @@ -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(); } diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index b51df842..eb3d43f2 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -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()); }