]> git.bitcoin.ninja Git - ldk-java/commitdiff
Add a simple wrapper for `disconnect_by_node_id` in `NioPeerHandler`
authorMatt Corallo <git@bluematt.me>
Fri, 6 Aug 2021 17:40:09 +0000 (17:40 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 9 Aug 2021 05:53:31 +0000 (05:53 +0000)
Fixes #36.

src/main/java/org/ldk/batteries/NioPeerHandler.java

index eac4d8058a898fd7a8af0a61ddb8e2be68627f92..991a6b135fda62468aa3878b1864cf4b1f512fe9 100644 (file)
@@ -236,6 +236,15 @@ public class NioPeerHandler {
         }
     }
 
+    /**
+     * Disconnects any connections currently open with the peer with the given node id.
+     *
+     * @param their_node_id must be a valid 33-byte public key
+     */
+    public void disconnect(byte[] their_node_id) {
+        this.peer_manager.disconnect_by_node_id(their_node_id, false);
+    }
+
     /**
      * Binds a listening socket to the given address, accepting incoming connections and handling them on the background
      * thread.