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 channel (both directions).
11 * Received within a channel announcement.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelInfo extends CommonBase {
15 ChannelInfo(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.ChannelInfo_free(ptr); }
23 * Protocol features of a channel communicated during its announcement
25 public ChannelFeatures get_features() {
26 long ret = bindings.ChannelInfo_get_features(this.ptr);
27 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
28 ret_hu_conv.ptrs_to.add(this);
33 * Protocol features of a channel communicated during its announcement
35 public void set_features(ChannelFeatures val) {
36 bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
37 this.ptrs_to.add(val);
41 * Source node of the first direction of a channel
43 public byte[] get_node_one() {
44 byte[] ret = bindings.ChannelInfo_get_node_one(this.ptr);
49 * Source node of the first direction of a channel
51 public void set_node_one(byte[] val) {
52 bindings.ChannelInfo_set_node_one(this.ptr, val);
56 * Details about the first direction of a channel
58 public DirectionalChannelInfo get_one_to_two() {
59 long ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
60 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
61 ret_hu_conv.ptrs_to.add(this);
66 * Details about the first direction of a channel
68 public void set_one_to_two(DirectionalChannelInfo val) {
69 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1);
70 this.ptrs_to.add(val);
74 * Source node of the second direction of a channel
76 public byte[] get_node_two() {
77 byte[] ret = bindings.ChannelInfo_get_node_two(this.ptr);
82 * Source node of the second direction of a channel
84 public void set_node_two(byte[] val) {
85 bindings.ChannelInfo_set_node_two(this.ptr, val);
89 * Details about the second direction of a channel
91 public DirectionalChannelInfo get_two_to_one() {
92 long ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
93 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
94 ret_hu_conv.ptrs_to.add(this);
99 * Details about the second direction of a channel
101 public void set_two_to_one(DirectionalChannelInfo val) {
102 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1);
103 this.ptrs_to.add(val);
107 * An initial announcement of the channel
108 * Mostly redundant with the data we store in fields explicitly.
109 * Everything else is useful only for sending out for initial routing sync.
110 * Not stored if contains excess data to prevent DoS.
112 public ChannelAnnouncement get_announcement_message() {
113 long ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
114 ChannelAnnouncement ret_hu_conv = new ChannelAnnouncement(null, ret);
115 ret_hu_conv.ptrs_to.add(this);
120 * An initial announcement of the channel
121 * Mostly redundant with the data we store in fields explicitly.
122 * Everything else is useful only for sending out for initial routing sync.
123 * Not stored if contains excess data to prevent DoS.
125 public void set_announcement_message(ChannelAnnouncement val) {
126 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
127 this.ptrs_to.add(val);
131 * Creates a copy of the ChannelInfo
133 public ChannelInfo clone() {
134 long ret = bindings.ChannelInfo_clone(this.ptr);
135 ChannelInfo ret_hu_conv = new ChannelInfo(null, ret);
136 ret_hu_conv.ptrs_to.add(this);
141 * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
143 public byte[] write() {
144 byte[] ret = bindings.ChannelInfo_write(this.ptr);
149 * Read a ChannelInfo from a byte array, created by ChannelInfo_write
151 public static Result_ChannelInfoDecodeErrorZ constructor_read(byte[] ser) {
152 long ret = bindings.ChannelInfo_read(ser);
153 Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret);