1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * The unsigned part of a channel_announcement
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class UnsignedChannelAnnouncement extends CommonBase {
15 UnsignedChannelAnnouncement(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.UnsignedChannelAnnouncement_free(ptr); }
23 * The advertised channel features
25 public ChannelFeatures get_features() {
26 long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr);
27 if (ret < 1024) { return null; }
28 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
29 ret_hu_conv.ptrs_to.add(this);
34 * The advertised channel features
36 public void set_features(ChannelFeatures val) {
37 bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
38 this.ptrs_to.add(val);
42 * The genesis hash of the blockchain where the channel is to be opened
44 public byte[] get_chain_hash() {
45 byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
50 * The genesis hash of the blockchain where the channel is to be opened
52 public void set_chain_hash(byte[] val) {
53 bindings.UnsignedChannelAnnouncement_set_chain_hash(this.ptr, val);
57 * The short channel ID
59 public long get_short_channel_id() {
60 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
65 * The short channel ID
67 public void set_short_channel_id(long val) {
68 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
72 * One of the two node_ids which are endpoints of this channel
74 public byte[] get_node_id_1() {
75 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
80 * One of the two node_ids which are endpoints of this channel
82 public void set_node_id_1(byte[] val) {
83 bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, val);
87 * The other of the two node_ids which are endpoints of this channel
89 public byte[] get_node_id_2() {
90 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
95 * The other of the two node_ids which are endpoints of this channel
97 public void set_node_id_2(byte[] val) {
98 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, val);
102 * The funding key for the first node
104 public byte[] get_bitcoin_key_1() {
105 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
110 * The funding key for the first node
112 public void set_bitcoin_key_1(byte[] val) {
113 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, val);
117 * The funding key for the second node
119 public byte[] get_bitcoin_key_2() {
120 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
125 * The funding key for the second node
127 public void set_bitcoin_key_2(byte[] val) {
128 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, val);
132 * Creates a copy of the UnsignedChannelAnnouncement
134 public UnsignedChannelAnnouncement clone() {
135 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
136 if (ret < 1024) { return null; }
137 UnsignedChannelAnnouncement ret_hu_conv = new UnsignedChannelAnnouncement(null, ret);
138 ret_hu_conv.ptrs_to.add(this);
143 * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
145 public byte[] write() {
146 byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
151 * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
153 public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
154 long ret = bindings.UnsignedChannelAnnouncement_read(ser);
155 if (ret < 1024) { return null; }
156 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);