1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Details about a node in the network, known from the network announcement.
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class NodeInfo extends CommonBase {
14 NodeInfo(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.NodeInfo_free(ptr); }
22 * All valid channels a node has announced
24 public void set_channels(long[] val) {
25 bindings.NodeInfo_set_channels(this.ptr, val);
29 * Lowest fees enabling routing via any of the enabled, known channels to a node.
30 * The two fields (flat and proportional fee) are independent,
31 * meaning they don't have to refer to the same channel.
33 public RoutingFees get_lowest_inbound_channel_fees() {
34 long ret = bindings.NodeInfo_get_lowest_inbound_channel_fees(this.ptr);
35 RoutingFees ret_hu_conv = new RoutingFees(null, ret);
36 ret_hu_conv.ptrs_to.add(this);
41 * Lowest fees enabling routing via any of the enabled, known channels to a node.
42 * The two fields (flat and proportional fee) are independent,
43 * meaning they don't have to refer to the same channel.
45 public void set_lowest_inbound_channel_fees(RoutingFees val) {
46 bindings.NodeInfo_set_lowest_inbound_channel_fees(this.ptr, val == null ? 0 : val.ptr & ~1);
47 this.ptrs_to.add(val);
51 * More information about a node from node_announcement.
52 * Optional because we store a Node entry after learning about it from
53 * a channel announcement, but before receiving a node announcement.
55 public NodeAnnouncementInfo get_announcement_info() {
56 long ret = bindings.NodeInfo_get_announcement_info(this.ptr);
57 NodeAnnouncementInfo ret_hu_conv = new NodeAnnouncementInfo(null, ret);
58 ret_hu_conv.ptrs_to.add(this);
63 * More information about a node from node_announcement.
64 * Optional because we store a Node entry after learning about it from
65 * a channel announcement, but before receiving a node announcement.
67 public void set_announcement_info(NodeAnnouncementInfo val) {
68 bindings.NodeInfo_set_announcement_info(this.ptr, val == null ? 0 : val.ptr & ~1);
69 this.ptrs_to.add(val);
73 * Constructs a new NodeInfo given each field
75 public static NodeInfo constructor_new(long[] channels_arg, RoutingFees lowest_inbound_channel_fees_arg, NodeAnnouncementInfo announcement_info_arg) {
76 long ret = bindings.NodeInfo_new(channels_arg, lowest_inbound_channel_fees_arg == null ? 0 : lowest_inbound_channel_fees_arg.ptr & ~1, announcement_info_arg == null ? 0 : announcement_info_arg.ptr & ~1);
77 NodeInfo ret_hu_conv = new NodeInfo(null, ret);
78 ret_hu_conv.ptrs_to.add(ret_hu_conv);
79 ret_hu_conv.ptrs_to.add(lowest_inbound_channel_fees_arg);
80 ret_hu_conv.ptrs_to.add(announcement_info_arg);
85 * Creates a copy of the NodeInfo
87 public NodeInfo clone() {
88 long ret = bindings.NodeInfo_clone(this.ptr);
89 NodeInfo ret_hu_conv = new NodeInfo(null, ret);
90 ret_hu_conv.ptrs_to.add(this);
95 * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
97 public byte[] write() {
98 byte[] ret = bindings.NodeInfo_write(this.ptr);
103 * Read a NodeInfo from a byte array, created by NodeInfo_write
105 public static Result_NodeInfoDecodeErrorZ constructor_read(byte[] ser) {
106 long ret = bindings.NodeInfo_read(ser);
107 Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret);