[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / PeerManager.java
index c12f1d159c57587c0602d994aaf1fadc41ad47ee..fbec38a6401979550ed4bf11b14da55390a880ab 100644 (file)
@@ -72,29 +72,39 @@ public class PeerManager extends CommonBase {
        }
 
        /**
-        * Get a list of tuples mapping from node id to network addresses for peers which have
-        * completed the initial handshake.
+        * Returns a list of [`PeerDetails`] for connected peers that have completed the initial
+        * handshake.
+        */
+       public PeerDetails[] list_peers() {
+               long[] ret = bindings.PeerManager_list_peers(this.ptr);
+               Reference.reachabilityFence(this);
+               int ret_conv_13_len = ret.length;
+               PeerDetails[] ret_conv_13_arr = new PeerDetails[ret_conv_13_len];
+               for (int n = 0; n < ret_conv_13_len; n++) {
+                       long ret_conv_13 = ret[n];
+                       org.ldk.structs.PeerDetails ret_conv_13_hu_conv = null; if (ret_conv_13 < 0 || ret_conv_13 > 4096) { ret_conv_13_hu_conv = new org.ldk.structs.PeerDetails(null, ret_conv_13); }
+                       if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.add(this); };
+                       ret_conv_13_arr[n] = ret_conv_13_hu_conv;
+               }
+               return ret_conv_13_arr;
+       }
+
+       /**
+        * Returns the [`PeerDetails`] of a connected peer that has completed the initial handshake.
         * 
-        * For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter
-        * passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial
-        * handshake has completed and we are sure the remote peer has the private key for the given
-        * [`PublicKey`].
+        * Will return `None` if the peer is unknown or it hasn't completed the initial handshake.
         * 
-        * The returned `Option`s will only be `Some` if an address had been previously given via
-        * [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`].
+        * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
-       public TwoTuple_PublicKeyCOption_SocketAddressZZ[] get_peer_node_ids() {
-               long[] ret = bindings.PeerManager_get_peer_node_ids(this.ptr);
+       @Nullable
+       public PeerDetails peer_by_node_id(byte[] their_node_id) {
+               long ret = bindings.PeerManager_peer_by_node_id(this.ptr, InternalUtils.check_arr_len(their_node_id, 33));
                Reference.reachabilityFence(this);
-               int ret_conv_43_len = ret.length;
-               TwoTuple_PublicKeyCOption_SocketAddressZZ[] ret_conv_43_arr = new TwoTuple_PublicKeyCOption_SocketAddressZZ[ret_conv_43_len];
-               for (int r = 0; r < ret_conv_43_len; r++) {
-                       long ret_conv_43 = ret[r];
-                       TwoTuple_PublicKeyCOption_SocketAddressZZ ret_conv_43_hu_conv = new TwoTuple_PublicKeyCOption_SocketAddressZZ(null, ret_conv_43);
-                       if (ret_conv_43_hu_conv != null) { ret_conv_43_hu_conv.ptrs_to.add(this); };
-                       ret_conv_43_arr[r] = ret_conv_43_hu_conv;
-               }
-               return ret_conv_43_arr;
+               Reference.reachabilityFence(their_node_id);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.PeerDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PeerDetails(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+               return ret_hu_conv;
        }
 
        /**