X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FCommitmentSigned.cs;h=adcfc649fb1defbca574f5203326a6fa0c1a1b1a;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=bb3d72fe9d98df488869067fa0ff79d289c92800;hpb=afc50e5d491a11364849383b75a8f939df703bac;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/CommitmentSigned.cs b/c_sharp/src/org/ldk/structs/CommitmentSigned.cs index bb3d72fe..adcfc649 100644 --- a/c_sharp/src/org/ldk/structs/CommitmentSigned.cs +++ b/c_sharp/src/org/ldk/structs/CommitmentSigned.cs @@ -21,16 +21,18 @@ public class CommitmentSigned : CommonBase { * The channel ID */ public byte[] get_channel_id() { - byte[] ret = bindings.CommitmentSigned_get_channel_id(this.ptr); + long ret = bindings.CommitmentSigned_get_channel_id(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * The channel ID */ public void set_channel_id(byte[] val) { - bindings.CommitmentSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + bindings.CommitmentSigned_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -39,16 +41,18 @@ public class CommitmentSigned : CommonBase { * A signature on the commitment transaction */ public byte[] get_signature() { - byte[] ret = bindings.CommitmentSigned_get_signature(this.ptr); + long ret = bindings.CommitmentSigned_get_signature(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * A signature on the commitment transaction */ public void set_signature(byte[] val) { - bindings.CommitmentSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + bindings.CommitmentSigned_set_signature(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -59,16 +63,25 @@ public class CommitmentSigned : CommonBase { * Returns a copy of the field. */ public byte[][] get_htlc_signatures() { - byte[][] ret = bindings.CommitmentSigned_get_htlc_signatures(this.ptr); + long ret = bindings.CommitmentSigned_get_htlc_signatures(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + int ret_conv_8_len = InternalUtils.getArrayLength(ret); + byte[][] ret_conv_8_arr = new byte[ret_conv_8_len][]; + for (int i = 0; i < ret_conv_8_len; i++) { + long ret_conv_8 = InternalUtils.getU64ArrayElem(ret, i); + byte[] ret_conv_8_conv = InternalUtils.decodeUint8Array(ret_conv_8); + ret_conv_8_arr[i] = ret_conv_8_conv; + } + bindings.free_buffer(ret); + return ret_conv_8_arr; } /** * Signatures on the HTLC transactions */ public void set_htlc_signatures(byte[][] val) { - bindings.CommitmentSigned_set_htlc_signatures(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_8 => InternalUtils.check_arr_len(val_conv_8, 64)) : null); + bindings.CommitmentSigned_set_htlc_signatures(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(val, val_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val_conv_8, 64))))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -77,7 +90,7 @@ public class CommitmentSigned : CommonBase { * Constructs a new CommitmentSigned given each field */ public static CommitmentSigned of(byte[] channel_id_arg, byte[] signature_arg, byte[][] htlc_signatures_arg) { - long ret = bindings.CommitmentSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(signature_arg, 64), htlc_signatures_arg != null ? InternalUtils.mapArray(htlc_signatures_arg, htlc_signatures_arg_conv_8 => InternalUtils.check_arr_len(htlc_signatures_arg_conv_8, 64)) : null); + long ret = bindings.CommitmentSigned_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(signature_arg, 64)), InternalUtils.encodeUint64Array(InternalUtils.mapArray(htlc_signatures_arg, htlc_signatures_arg_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(htlc_signatures_arg_conv_8, 64))))); GC.KeepAlive(channel_id_arg); GC.KeepAlive(signature_arg); GC.KeepAlive(htlc_signatures_arg); @@ -126,16 +139,18 @@ public class CommitmentSigned : CommonBase { * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read */ public byte[] write() { - byte[] ret = bindings.CommitmentSigned_write(this.ptr); + long ret = bindings.CommitmentSigned_write(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write */ public static Result_CommitmentSignedDecodeErrorZ read(byte[] ser) { - long ret = bindings.CommitmentSigned_read(ser); + long ret = bindings.CommitmentSigned_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret);