From dbaa9580d3f622019f255d4965343eeb529ee5a3 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 4 Sep 2021 20:39:32 +0000 Subject: [PATCH] Rename ChannelManagerConstructor.ChannelManagerPersister to EventHandler ChannelManagerPersister is a bit of a misnomer for the struct which now handles events as well. Thus, we rename it to focus on the event-handling function here. --- .../org/ldk/batteries/ChannelManagerConstructor.java | 10 +++++----- src/test/java/org/ldk/HumanObjectPeerTest.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java index 40f6ac19..a2181261 100644 --- a/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java +++ b/src/main/java/org/ldk/batteries/ChannelManagerConstructor.java @@ -134,7 +134,7 @@ public class ChannelManagerConstructor { * Abstract interface which should handle Events and persist the ChannelManager. When you call chain_sync_completed * a background thread is started which will automatically call these methods for you when events occur. */ - public interface ChannelManagerPersister { + public interface EventHandler { void handle_event(Event events); void persist_manager(byte[] channel_manager_bytes); } @@ -146,17 +146,17 @@ public class ChannelManagerConstructor { * ChannelManager are processed as normal. * * This also spawns a background thread which will call the appropriate methods on the provided - * ChannelManagerPersister as required. + * EventHandler as required. */ - public void chain_sync_completed(ChannelManagerPersister persister) { + public void chain_sync_completed(EventHandler event_handler) { if (background_processor != null) { return; } for (TwoTuple monitor: channel_monitors) { this.chain_monitor.as_Watch().watch_channel(monitor.a.get_funding_txo().a, monitor.a); } background_processor = BackgroundProcessor.start(org.ldk.structs.ChannelManagerPersister.new_impl(channel_manager -> { - persister.persist_manager(channel_manager.write()); + event_handler.persist_manager(channel_manager.write()); return Result_NoneErrorZ.ok(); - }), EventHandler.new_impl(persister::handle_event), + }), org.ldk.structs.EventHandler.new_impl(event_handler::handle_event), this.chain_monitor, this.channel_manager, this.peer_manager, this.logger); } diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index 57b75042..1be48264 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -304,7 +304,7 @@ class HumanObjectPeerTestInstance { } this.constructor = new ChannelManagerConstructor(Network.LDKNetwork_Bitcoin, UserConfig.with_default(), new byte[32], 0, this.keys_interface, this.fee_estimator, this.chain_monitor, route_handler, this.tx_broadcaster, this.logger); - constructor.chain_sync_completed(new ChannelManagerConstructor.ChannelManagerPersister() { + constructor.chain_sync_completed(new ChannelManagerConstructor.EventHandler() { @Override public void handle_event(Event event) { synchronized (pending_manager_events) { pending_manager_events.add(event); @@ -337,7 +337,7 @@ class HumanObjectPeerTestInstance { try { this.constructor = new ChannelManagerConstructor(serialized, monitors, this.keys_interface, this.fee_estimator, this.chain_monitor, this.filter, this.router, this.tx_broadcaster, this.logger); - constructor.chain_sync_completed(new ChannelManagerConstructor.ChannelManagerPersister() { + constructor.chain_sync_completed(new ChannelManagerConstructor.EventHandler() { @Override public void handle_event(Event event) { synchronized (pending_manager_events) { pending_manager_events.add(event); -- 2.39.5