6 namespace org { namespace ldk { namespace structs {
10 * The unsigned part of a [`channel_announcement`] message.
12 * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
14 public class UnsignedChannelAnnouncement : CommonBase {
15 internal UnsignedChannelAnnouncement(object _dummy, long ptr) : base(ptr) { }
16 ~UnsignedChannelAnnouncement() {
17 if (ptr != 0) { bindings.UnsignedChannelAnnouncement_free(ptr); }
21 * The advertised channel features
23 public ChannelFeatures get_features() {
24 long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
33 * The advertised channel features
35 public void set_features(org.ldk.structs.ChannelFeatures val) {
36 bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * The genesis hash of the blockchain where the channel is to be opened
45 public byte[] get_chain_hash() {
46 long ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
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.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
63 * The short channel ID
65 public long get_short_channel_id() {
66 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
72 * The short channel ID
74 public void set_short_channel_id(long val) {
75 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
81 * One of the two `node_id`s which are endpoints of this channel
83 public NodeId get_node_id_1() {
84 long ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
86 if (ret >= 0 && ret <= 4096) { return null; }
87 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
88 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
93 * One of the two `node_id`s which are endpoints of this channel
95 public void set_node_id_1(org.ldk.structs.NodeId val) {
96 bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, val == null ? 0 : val.ptr);
99 if (this != null) { this.ptrs_to.AddLast(val); };
103 * The other of the two `node_id`s which are endpoints of this channel
105 public NodeId get_node_id_2() {
106 long ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
108 if (ret >= 0 && ret <= 4096) { return null; }
109 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
115 * The other of the two `node_id`s which are endpoints of this channel
117 public void set_node_id_2(org.ldk.structs.NodeId val) {
118 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, val == null ? 0 : val.ptr);
121 if (this != null) { this.ptrs_to.AddLast(val); };
125 * The funding key for the first node
127 public NodeId get_bitcoin_key_1() {
128 long ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
130 if (ret >= 0 && ret <= 4096) { return null; }
131 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
132 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
137 * The funding key for the first node
139 public void set_bitcoin_key_1(org.ldk.structs.NodeId val) {
140 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, val == null ? 0 : val.ptr);
143 if (this != null) { this.ptrs_to.AddLast(val); };
147 * The funding key for the second node
149 public NodeId get_bitcoin_key_2() {
150 long ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
159 * The funding key for the second node
161 public void set_bitcoin_key_2(org.ldk.structs.NodeId val) {
162 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, val == null ? 0 : val.ptr);
165 if (this != null) { this.ptrs_to.AddLast(val); };
169 * Excess data which was signed as a part of the message which we do not (yet) understand how
172 * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
174 * Returns a copy of the field.
176 public byte[] get_excess_data() {
177 long ret = bindings.UnsignedChannelAnnouncement_get_excess_data(this.ptr);
179 if (ret >= 0 && ret <= 4096) { return null; }
180 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
185 * Excess data which was signed as a part of the message which we do not (yet) understand how
188 * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
190 public void set_excess_data(byte[] val) {
191 bindings.UnsignedChannelAnnouncement_set_excess_data(this.ptr, InternalUtils.encodeUint8Array(val));
197 * Constructs a new UnsignedChannelAnnouncement given each field
199 public static UnsignedChannelAnnouncement of(org.ldk.structs.ChannelFeatures features_arg, byte[] chain_hash_arg, long short_channel_id_arg, org.ldk.structs.NodeId node_id_1_arg, org.ldk.structs.NodeId node_id_2_arg, org.ldk.structs.NodeId bitcoin_key_1_arg, org.ldk.structs.NodeId bitcoin_key_2_arg, byte[] excess_data_arg) {
200 long ret = bindings.UnsignedChannelAnnouncement_new(features_arg == null ? 0 : features_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), short_channel_id_arg, node_id_1_arg == null ? 0 : node_id_1_arg.ptr, node_id_2_arg == null ? 0 : node_id_2_arg.ptr, bitcoin_key_1_arg == null ? 0 : bitcoin_key_1_arg.ptr, bitcoin_key_2_arg == null ? 0 : bitcoin_key_2_arg.ptr, InternalUtils.encodeUint8Array(excess_data_arg));
201 GC.KeepAlive(features_arg);
202 GC.KeepAlive(chain_hash_arg);
203 GC.KeepAlive(short_channel_id_arg);
204 GC.KeepAlive(node_id_1_arg);
205 GC.KeepAlive(node_id_2_arg);
206 GC.KeepAlive(bitcoin_key_1_arg);
207 GC.KeepAlive(bitcoin_key_2_arg);
208 GC.KeepAlive(excess_data_arg);
209 if (ret >= 0 && ret <= 4096) { return null; }
210 org.ldk.structs.UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, ret); }
211 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
212 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(features_arg); };
213 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(node_id_1_arg); };
214 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(node_id_2_arg); };
215 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(bitcoin_key_1_arg); };
216 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(bitcoin_key_2_arg); };
220 internal long clone_ptr() {
221 long ret = bindings.UnsignedChannelAnnouncement_clone_ptr(this.ptr);
227 * Creates a copy of the UnsignedChannelAnnouncement
229 public UnsignedChannelAnnouncement clone() {
230 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
232 if (ret >= 0 && ret <= 4096) { return null; }
233 org.ldk.structs.UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, ret); }
234 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
239 * Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement.
242 long ret = bindings.UnsignedChannelAnnouncement_hash(this.ptr);
247 public override int GetHashCode() {
248 return (int)this.hash();
251 * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
252 * This ignores pointers and is_owned flags and looks at the values in fields.
253 * Two objects with NULL inner values will be considered "equal" here.
255 public bool eq(org.ldk.structs.UnsignedChannelAnnouncement b) {
256 bool ret = bindings.UnsignedChannelAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
259 if (this != null) { this.ptrs_to.AddLast(b); };
263 public override bool Equals(object o) {
264 if (!(o is UnsignedChannelAnnouncement)) return false;
265 return this.eq((UnsignedChannelAnnouncement)o);
268 * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
270 public byte[] write() {
271 long ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
273 if (ret >= 0 && ret <= 4096) { return null; }
274 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
279 * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
281 public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
282 long ret = bindings.UnsignedChannelAnnouncement_read(InternalUtils.encodeUint8Array(ser));
284 if (ret >= 0 && ret <= 4096) { return null; }
285 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);