6 namespace org { namespace ldk { namespace structs {
10 * A [`funding_signed`] message to be sent to or received from a peer.
12 * Used in V1 channel establishment
14 * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
16 public class FundingSigned : CommonBase {
17 internal FundingSigned(object _dummy, long ptr) : base(ptr) { }
19 if (ptr != 0) { bindings.FundingSigned_free(ptr); }
25 public ChannelId get_channel_id() {
26 long ret = bindings.FundingSigned_get_channel_id(this.ptr);
28 if (ret >= 0 && ret <= 4096) { return null; }
29 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
30 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
37 public void set_channel_id(org.ldk.structs.ChannelId val) {
38 bindings.FundingSigned_set_channel_id(this.ptr, val.ptr);
41 if (this != null) { this.ptrs_to.AddLast(val); };
45 * The signature of the channel acceptor (fundee) on the initial commitment transaction
47 public byte[] get_signature() {
48 long ret = bindings.FundingSigned_get_signature(this.ptr);
50 if (ret >= 0 && ret <= 4096) { return null; }
51 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
56 * The signature of the channel acceptor (fundee) on the initial commitment transaction
58 public void set_signature(byte[] val) {
59 bindings.FundingSigned_set_signature(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64)));
65 * Constructs a new FundingSigned given each field
67 public static FundingSigned of(org.ldk.structs.ChannelId channel_id_arg, byte[] signature_arg) {
68 long ret = bindings.FundingSigned_new(channel_id_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(signature_arg, 64)));
69 GC.KeepAlive(channel_id_arg);
70 GC.KeepAlive(signature_arg);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.FundingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingSigned(null, ret); }
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
74 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
78 internal long clone_ptr() {
79 long ret = bindings.FundingSigned_clone_ptr(this.ptr);
85 * Creates a copy of the FundingSigned
87 public FundingSigned clone() {
88 long ret = bindings.FundingSigned_clone(this.ptr);
90 if (ret >= 0 && ret <= 4096) { return null; }
91 org.ldk.structs.FundingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingSigned(null, ret); }
92 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
97 * Generates a non-cryptographic 64-bit hash of the FundingSigned.
100 long ret = bindings.FundingSigned_hash(this.ptr);
105 public override int GetHashCode() {
106 return (int)this.hash();
109 * Checks if two FundingSigneds contain equal inner contents.
110 * This ignores pointers and is_owned flags and looks at the values in fields.
111 * Two objects with NULL inner values will be considered "equal" here.
113 public bool eq(org.ldk.structs.FundingSigned b) {
114 bool ret = bindings.FundingSigned_eq(this.ptr, b.ptr);
117 if (this != null) { this.ptrs_to.AddLast(b); };
121 public override bool Equals(object o) {
122 if (!(o is FundingSigned)) return false;
123 return this.eq((FundingSigned)o);
126 * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
128 public byte[] write() {
129 long ret = bindings.FundingSigned_write(this.ptr);
131 if (ret >= 0 && ret <= 4096) { return null; }
132 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
137 * Read a FundingSigned from a byte array, created by FundingSigned_write
139 public static Result_FundingSignedDecodeErrorZ read(byte[] ser) {
140 long ret = bindings.FundingSigned_read(InternalUtils.encodeUint8Array(ser));
142 if (ret >= 0 && ret <= 4096) { return null; }
143 Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret);