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 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
31 if (ret_hu_conv != null) { 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);
40 Reference.reachabilityFence(this);
41 Reference.reachabilityFence(val);
42 if (this != null) { this.ptrs_to.add(val); };
46 * The genesis hash of the blockchain where the channel is to be opened
48 public byte[] get_chain_hash() {
49 byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
50 Reference.reachabilityFence(this);
55 * The genesis hash of the blockchain where the channel is to be opened
57 public void set_chain_hash(byte[] val) {
58 bindings.UnsignedChannelAnnouncement_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
59 Reference.reachabilityFence(this);
60 Reference.reachabilityFence(val);
64 * The short channel ID
66 public long get_short_channel_id() {
67 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
68 Reference.reachabilityFence(this);
73 * The short channel ID
75 public void set_short_channel_id(long val) {
76 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
77 Reference.reachabilityFence(this);
78 Reference.reachabilityFence(val);
82 * One of the two node_ids which are endpoints of this channel
84 public byte[] get_node_id_1() {
85 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
86 Reference.reachabilityFence(this);
91 * One of the two node_ids which are endpoints of this channel
93 public void set_node_id_1(byte[] val) {
94 bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, InternalUtils.check_arr_len(val, 33));
95 Reference.reachabilityFence(this);
96 Reference.reachabilityFence(val);
100 * The other of the two node_ids which are endpoints of this channel
102 public byte[] get_node_id_2() {
103 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
104 Reference.reachabilityFence(this);
109 * The other of the two node_ids which are endpoints of this channel
111 public void set_node_id_2(byte[] val) {
112 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, InternalUtils.check_arr_len(val, 33));
113 Reference.reachabilityFence(this);
114 Reference.reachabilityFence(val);
118 * The funding key for the first node
120 public byte[] get_bitcoin_key_1() {
121 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
122 Reference.reachabilityFence(this);
127 * The funding key for the first node
129 public void set_bitcoin_key_1(byte[] val) {
130 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, InternalUtils.check_arr_len(val, 33));
131 Reference.reachabilityFence(this);
132 Reference.reachabilityFence(val);
136 * The funding key for the second node
138 public byte[] get_bitcoin_key_2() {
139 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
140 Reference.reachabilityFence(this);
145 * The funding key for the second node
147 public void set_bitcoin_key_2(byte[] val) {
148 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, InternalUtils.check_arr_len(val, 33));
149 Reference.reachabilityFence(this);
150 Reference.reachabilityFence(val);
154 long ret = bindings.UnsignedChannelAnnouncement_clone_ptr(this.ptr);
155 Reference.reachabilityFence(this);
160 * Creates a copy of the UnsignedChannelAnnouncement
162 public UnsignedChannelAnnouncement clone() {
163 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
164 Reference.reachabilityFence(this);
165 if (ret >= 0 && ret <= 4096) { return null; }
166 org.ldk.structs.UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, ret); }
167 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
172 * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
174 public byte[] write() {
175 byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
176 Reference.reachabilityFence(this);
181 * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
183 public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
184 long ret = bindings.UnsignedChannelAnnouncement_read(ser);
185 Reference.reachabilityFence(ser);
186 if (ret >= 0 && ret <= 4096) { return null; }
187 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);