From: Matt Corallo Date: Wed, 16 Jun 2021 00:14:30 +0000 (+0000) Subject: Do not rely on assertions being enabled in ChannelManagerConstructor X-Git-Tag: v0.0.98.2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=c1894f9d32ddea3884bda17c1a9964fa5412e28e;p=ldk-java Do not rely on assertions being enabled in ChannelManagerConstructor --- diff --git a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java index d5585408..da5e3fb9 100644 --- a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java +++ b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java @@ -88,7 +88,11 @@ public class ChannelManagerConstructor { this.peer_manager = PeerManager.of(channel_manager.as_ChannelMessageHandler(), (IgnoringMessageHandler.of()).as_RoutingMessageHandler(), keys_interface.get_node_secret(), random_data, logger); } NioPeerHandler nio_peer_handler = null; - try { nio_peer_handler = new NioPeerHandler(this.peer_manager); } catch (IOException e) { assert false; } + try { + nio_peer_handler = new NioPeerHandler(this.peer_manager); + } catch (IOException e) { + throw new IllegalStateException("We should never fail to construct nio objects unless we're on a platform that cannot run LDK."); + } this.nio_peer_handler = nio_peer_handler; if (filter != null) { for (ChannelMonitor monitor : monitors) { @@ -118,7 +122,11 @@ public class ChannelManagerConstructor { this.peer_manager = PeerManager.of(channel_manager.as_ChannelMessageHandler(), (IgnoringMessageHandler.of()).as_RoutingMessageHandler(), keys_interface.get_node_secret(), random_data, logger); } NioPeerHandler nio_peer_handler = null; - try { nio_peer_handler = new NioPeerHandler(this.peer_manager); } catch (IOException e) { assert false; } + try { + nio_peer_handler = new NioPeerHandler(this.peer_manager); + } catch (IOException e) { + throw new IllegalStateException("We should never fail to construct nio objects unless we're on a platform that cannot run LDK."); + } this.nio_peer_handler = nio_peer_handler; }