6 namespace org { namespace ldk { namespace structs {
10 * A [`channel_announcement`] message to be sent to or received from a peer.
12 * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
14 public class ChannelAnnouncement : CommonBase {
15 internal ChannelAnnouncement(object _dummy, long ptr) : base(ptr) { }
16 ~ChannelAnnouncement() {
17 if (ptr != 0) { bindings.ChannelAnnouncement_free(ptr); }
21 * Authentication of the announcement by the first public node
23 public byte[] get_node_signature_1() {
24 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_1(this.ptr);
30 * Authentication of the announcement by the first public node
32 public void set_node_signature_1(byte[] val) {
33 bindings.ChannelAnnouncement_set_node_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64));
39 * Authentication of the announcement by the second public node
41 public byte[] get_node_signature_2() {
42 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_2(this.ptr);
48 * Authentication of the announcement by the second public node
50 public void set_node_signature_2(byte[] val) {
51 bindings.ChannelAnnouncement_set_node_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64));
57 * Proof of funding UTXO ownership by the first public node
59 public byte[] get_bitcoin_signature_1() {
60 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_1(this.ptr);
66 * Proof of funding UTXO ownership by the first public node
68 public void set_bitcoin_signature_1(byte[] val) {
69 bindings.ChannelAnnouncement_set_bitcoin_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64));
75 * Proof of funding UTXO ownership by the second public node
77 public byte[] get_bitcoin_signature_2() {
78 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_2(this.ptr);
84 * Proof of funding UTXO ownership by the second public node
86 public void set_bitcoin_signature_2(byte[] val) {
87 bindings.ChannelAnnouncement_set_bitcoin_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64));
93 * The actual announcement
95 public UnsignedChannelAnnouncement get_contents() {
96 long ret = bindings.ChannelAnnouncement_get_contents(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 org.ldk.structs.UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, ret); }
100 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105 * The actual announcement
107 public void set_contents(org.ldk.structs.UnsignedChannelAnnouncement val) {
108 bindings.ChannelAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr);
111 if (this != null) { this.ptrs_to.AddLast(val); };
115 * Constructs a new ChannelAnnouncement given each field
117 public static ChannelAnnouncement of(byte[] node_signature_1_arg, byte[] node_signature_2_arg, byte[] bitcoin_signature_1_arg, byte[] bitcoin_signature_2_arg, org.ldk.structs.UnsignedChannelAnnouncement contents_arg) {
118 long ret = bindings.ChannelAnnouncement_new(InternalUtils.check_arr_len(node_signature_1_arg, 64), InternalUtils.check_arr_len(node_signature_2_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_1_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_2_arg, 64), contents_arg == null ? 0 : contents_arg.ptr);
119 GC.KeepAlive(node_signature_1_arg);
120 GC.KeepAlive(node_signature_2_arg);
121 GC.KeepAlive(bitcoin_signature_1_arg);
122 GC.KeepAlive(bitcoin_signature_2_arg);
123 GC.KeepAlive(contents_arg);
124 if (ret >= 0 && ret <= 4096) { return null; }
125 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
126 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
127 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(contents_arg); };
131 internal long clone_ptr() {
132 long ret = bindings.ChannelAnnouncement_clone_ptr(this.ptr);
138 * Creates a copy of the ChannelAnnouncement
140 public ChannelAnnouncement clone() {
141 long ret = bindings.ChannelAnnouncement_clone(this.ptr);
143 if (ret >= 0 && ret <= 4096) { return null; }
144 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
145 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
150 * Checks if two ChannelAnnouncements contain equal inner contents.
151 * This ignores pointers and is_owned flags and looks at the values in fields.
152 * Two objects with NULL inner values will be considered "equal" here.
154 public bool eq(org.ldk.structs.ChannelAnnouncement b) {
155 bool ret = bindings.ChannelAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
158 if (this != null) { this.ptrs_to.AddLast(b); };
162 public override bool Equals(object o) {
163 if (!(o is ChannelAnnouncement)) return false;
164 return this.eq((ChannelAnnouncement)o);
167 * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
169 public byte[] write() {
170 byte[] ret = bindings.ChannelAnnouncement_write(this.ptr);
176 * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
178 public static Result_ChannelAnnouncementDecodeErrorZ read(byte[] ser) {
179 long ret = bindings.ChannelAnnouncement_read(ser);
181 if (ret >= 0 && ret <= 4096) { return null; }
182 Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);