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 * The unsigned part of a channel_announcement
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UnsignedChannelAnnouncement extends CommonBase {
16 UnsignedChannelAnnouncement(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.UnsignedChannelAnnouncement_free(ptr); }
24 * The advertised channel features
26 public ChannelFeatures get_features() {
27 long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr);
28 Reference.reachabilityFence(this);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); }
31 ret_hu_conv.ptrs_to.add(this);
36 * The advertised channel features
38 public void set_features(ChannelFeatures val) {
39 bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
40 Reference.reachabilityFence(this);
41 Reference.reachabilityFence(val);
45 * The genesis hash of the blockchain where the channel is to be opened
47 public byte[] get_chain_hash() {
48 byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
49 Reference.reachabilityFence(this);
54 * The genesis hash of the blockchain where the channel is to be opened
56 public void set_chain_hash(byte[] val) {
57 bindings.UnsignedChannelAnnouncement_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
58 Reference.reachabilityFence(this);
59 Reference.reachabilityFence(val);
63 * The short channel ID
65 public long get_short_channel_id() {
66 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
67 Reference.reachabilityFence(this);
72 * The short channel ID
74 public void set_short_channel_id(long val) {
75 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
76 Reference.reachabilityFence(this);
77 Reference.reachabilityFence(val);
81 * One of the two node_ids which are endpoints of this channel
83 public byte[] get_node_id_1() {
84 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
85 Reference.reachabilityFence(this);
90 * One of the two node_ids which are endpoints of this channel
92 public void set_node_id_1(byte[] val) {
93 bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, InternalUtils.check_arr_len(val, 33));
94 Reference.reachabilityFence(this);
95 Reference.reachabilityFence(val);
99 * The other of the two node_ids which are endpoints of this channel
101 public byte[] get_node_id_2() {
102 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
103 Reference.reachabilityFence(this);
108 * The other of the two node_ids which are endpoints of this channel
110 public void set_node_id_2(byte[] val) {
111 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, InternalUtils.check_arr_len(val, 33));
112 Reference.reachabilityFence(this);
113 Reference.reachabilityFence(val);
117 * The funding key for the first node
119 public byte[] get_bitcoin_key_1() {
120 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
121 Reference.reachabilityFence(this);
126 * The funding key for the first node
128 public void set_bitcoin_key_1(byte[] val) {
129 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, InternalUtils.check_arr_len(val, 33));
130 Reference.reachabilityFence(this);
131 Reference.reachabilityFence(val);
135 * The funding key for the second node
137 public byte[] get_bitcoin_key_2() {
138 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
139 Reference.reachabilityFence(this);
144 * The funding key for the second node
146 public void set_bitcoin_key_2(byte[] val) {
147 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, InternalUtils.check_arr_len(val, 33));
148 Reference.reachabilityFence(this);
149 Reference.reachabilityFence(val);
153 long ret = bindings.UnsignedChannelAnnouncement_clone_ptr(this.ptr);
154 Reference.reachabilityFence(this);
159 * Creates a copy of the UnsignedChannelAnnouncement
161 public UnsignedChannelAnnouncement clone() {
162 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
163 Reference.reachabilityFence(this);
164 if (ret >= 0 && ret <= 4096) { return null; }
165 UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelAnnouncement(null, ret); }
166 ret_hu_conv.ptrs_to.add(this);
171 * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
173 public byte[] write() {
174 byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
175 Reference.reachabilityFence(this);
180 * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
182 public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
183 long ret = bindings.UnsignedChannelAnnouncement_read(ser);
184 Reference.reachabilityFence(ser);
185 if (ret >= 0 && ret <= 4096) { return null; }
186 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);