1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A read-only view of [`NetworkGraph`].
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ReadOnlyNetworkGraph extends CommonBase implements AutoCloseable {
16 ReadOnlyNetworkGraph(Object _dummy, long ptr) { super(ptr); }
17 @Override public void close() {
18 if (ptr != 0) { bindings.ReadOnlyNetworkGraph_free(ptr); }
22 * Get network addresses by node id.
23 * Returns None if the requested node is completely unknown,
24 * or if node announcement for the node was never received.
26 public Option_CVec_NetAddressZZ get_addresses(byte[] pubkey) {
27 long ret = bindings.ReadOnlyNetworkGraph_get_addresses(this.ptr, InternalUtils.check_arr_len(pubkey, 33));
28 Reference.reachabilityFence(this);
29 Reference.reachabilityFence(pubkey);
30 if (ret >= 0 && ret <= 4096) { return null; }
31 org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret);
32 ret_hu_conv.ptrs_to.add(this);