Rename ChannelManagerConstructor.ChannelManagerPersister to EventHandler
authorMatt Corallo <git@bluematt.me>
Sat, 4 Sep 2021 20:39:32 +0000 (20:39 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 24 Sep 2021 19:32:52 +0000 (19:32 +0000)
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.

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

index 40f6ac1919aa1e455564af98ab6d7b25c54f3917..a2181261c32722c5ffbd51df1fd601529a9ca1aa 100644 (file)
@@ -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<ChannelMonitor, byte[]> 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);
     }
 
index 57b750427fbe28b8af191a3d3cc4601a93dcaf6d..1be48264d5742efaff53a8666092f273c29ee719 100644 (file)
@@ -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);