6 namespace org { namespace ldk { namespace structs {
10 * A channel_announcement message to be sent or received from a peer
12 public class ChannelAnnouncement : CommonBase {
13 internal ChannelAnnouncement(object _dummy, long ptr) : base(ptr) { }
14 ~ChannelAnnouncement() {
15 if (ptr != 0) { bindings.ChannelAnnouncement_free(ptr); }
19 * Authentication of the announcement by the first public node
21 public byte[] get_node_signature_1() {
22 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_1(this.ptr);
28 * Authentication of the announcement by the first public node
30 public void set_node_signature_1(byte[] val) {
31 bindings.ChannelAnnouncement_set_node_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64));
37 * Authentication of the announcement by the second public node
39 public byte[] get_node_signature_2() {
40 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_2(this.ptr);
46 * Authentication of the announcement by the second public node
48 public void set_node_signature_2(byte[] val) {
49 bindings.ChannelAnnouncement_set_node_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64));
55 * Proof of funding UTXO ownership by the first public node
57 public byte[] get_bitcoin_signature_1() {
58 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_1(this.ptr);
64 * Proof of funding UTXO ownership by the first public node
66 public void set_bitcoin_signature_1(byte[] val) {
67 bindings.ChannelAnnouncement_set_bitcoin_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64));
73 * Proof of funding UTXO ownership by the second public node
75 public byte[] get_bitcoin_signature_2() {
76 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_2(this.ptr);
82 * Proof of funding UTXO ownership by the second public node
84 public void set_bitcoin_signature_2(byte[] val) {
85 bindings.ChannelAnnouncement_set_bitcoin_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64));
91 * The actual announcement
93 public UnsignedChannelAnnouncement get_contents() {
94 long ret = bindings.ChannelAnnouncement_get_contents(this.ptr);
96 if (ret >= 0 && ret <= 4096) { return null; }
97 org.ldk.structs.UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, ret); }
98 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
103 * The actual announcement
105 public void set_contents(org.ldk.structs.UnsignedChannelAnnouncement val) {
106 bindings.ChannelAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr);
109 if (this != null) { this.ptrs_to.AddLast(val); };
113 * Constructs a new ChannelAnnouncement given each field
115 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) {
116 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);
117 GC.KeepAlive(node_signature_1_arg);
118 GC.KeepAlive(node_signature_2_arg);
119 GC.KeepAlive(bitcoin_signature_1_arg);
120 GC.KeepAlive(bitcoin_signature_2_arg);
121 GC.KeepAlive(contents_arg);
122 if (ret >= 0 && ret <= 4096) { return null; }
123 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
124 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
125 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(contents_arg); };
129 internal long clone_ptr() {
130 long ret = bindings.ChannelAnnouncement_clone_ptr(this.ptr);
136 * Creates a copy of the ChannelAnnouncement
138 public ChannelAnnouncement clone() {
139 long ret = bindings.ChannelAnnouncement_clone(this.ptr);
141 if (ret >= 0 && ret <= 4096) { return null; }
142 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
143 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
148 * Checks if two ChannelAnnouncements contain equal inner contents.
149 * This ignores pointers and is_owned flags and looks at the values in fields.
150 * Two objects with NULL inner values will be considered "equal" here.
152 public bool eq(org.ldk.structs.ChannelAnnouncement b) {
153 bool ret = bindings.ChannelAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
156 if (this != null) { this.ptrs_to.AddLast(b); };
160 public override bool Equals(object o) {
161 if (!(o is ChannelAnnouncement)) return false;
162 return this.eq((ChannelAnnouncement)o);
165 * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
167 public byte[] write() {
168 byte[] ret = bindings.ChannelAnnouncement_write(this.ptr);
174 * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
176 public static Result_ChannelAnnouncementDecodeErrorZ read(byte[] ser) {
177 long ret = bindings.ChannelAnnouncement_read(ser);
179 if (ret >= 0 && ret <= 4096) { return null; }
180 Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);