X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FBuiltCommitmentTransaction.cs;fp=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FBuiltCommitmentTransaction.cs;h=9b78bfeb0ddd7267bab805c893d946be7aa932ce;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=f5452bee5d4c14baa4ed2c0b6f1cefd0005ce389;hpb=afc50e5d491a11364849383b75a8f939df703bac;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/BuiltCommitmentTransaction.cs b/c_sharp/src/org/ldk/structs/BuiltCommitmentTransaction.cs index f5452bee..9b78bfeb 100644 --- a/c_sharp/src/org/ldk/structs/BuiltCommitmentTransaction.cs +++ b/c_sharp/src/org/ldk/structs/BuiltCommitmentTransaction.cs @@ -19,16 +19,18 @@ public class BuiltCommitmentTransaction : CommonBase { * The commitment transaction */ public byte[] get_transaction() { - byte[] ret = bindings.BuiltCommitmentTransaction_get_transaction(this.ptr); + long ret = bindings.BuiltCommitmentTransaction_get_transaction(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * The commitment transaction */ public void set_transaction(byte[] val) { - bindings.BuiltCommitmentTransaction_set_transaction(this.ptr, val); + bindings.BuiltCommitmentTransaction_set_transaction(this.ptr, InternalUtils.encodeUint8Array(val)); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -40,9 +42,11 @@ public class BuiltCommitmentTransaction : CommonBase { * multiple times. */ public byte[] get_txid() { - byte[] ret = bindings.BuiltCommitmentTransaction_get_txid(this.ptr); + long ret = bindings.BuiltCommitmentTransaction_get_txid(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** @@ -52,7 +56,7 @@ public class BuiltCommitmentTransaction : CommonBase { * multiple times. */ public void set_txid(byte[] val) { - bindings.BuiltCommitmentTransaction_set_txid(this.ptr, InternalUtils.check_arr_len(val, 32)); + bindings.BuiltCommitmentTransaction_set_txid(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -61,7 +65,7 @@ public class BuiltCommitmentTransaction : CommonBase { * Constructs a new BuiltCommitmentTransaction given each field */ public static BuiltCommitmentTransaction of(byte[] transaction_arg, byte[] txid_arg) { - long ret = bindings.BuiltCommitmentTransaction_new(transaction_arg, InternalUtils.check_arr_len(txid_arg, 32)); + long ret = bindings.BuiltCommitmentTransaction_new(InternalUtils.encodeUint8Array(transaction_arg), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(txid_arg, 32))); GC.KeepAlive(transaction_arg); GC.KeepAlive(txid_arg); if (ret >= 0 && ret <= 4096) { return null; } @@ -92,16 +96,18 @@ public class BuiltCommitmentTransaction : CommonBase { * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read */ public byte[] write() { - byte[] ret = bindings.BuiltCommitmentTransaction_write(this.ptr); + long ret = bindings.BuiltCommitmentTransaction_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 BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write */ public static Result_BuiltCommitmentTransactionDecodeErrorZ read(byte[] ser) { - long ret = bindings.BuiltCommitmentTransaction_read(ser); + long ret = bindings.BuiltCommitmentTransaction_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); @@ -114,37 +120,43 @@ public class BuiltCommitmentTransaction : CommonBase { * This can be used to verify a signature. */ public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) { - byte[] ret = bindings.BuiltCommitmentTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis); + long ret = bindings.BuiltCommitmentTransaction_get_sighash_all(this.ptr, InternalUtils.encodeUint8Array(funding_redeemscript), channel_value_satoshis); GC.KeepAlive(this); GC.KeepAlive(funding_redeemscript); GC.KeepAlive(channel_value_satoshis); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Signs the counterparty's commitment transaction. */ public byte[] sign_counterparty_commitment(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) { - byte[] ret = bindings.BuiltCommitmentTransaction_sign_counterparty_commitment(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis); + long ret = bindings.BuiltCommitmentTransaction_sign_counterparty_commitment(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_key, 32)), InternalUtils.encodeUint8Array(funding_redeemscript), channel_value_satoshis); GC.KeepAlive(this); GC.KeepAlive(funding_key); GC.KeepAlive(funding_redeemscript); GC.KeepAlive(channel_value_satoshis); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Signs the holder commitment transaction because we are about to broadcast it. */ public byte[] sign_holder_commitment(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis, org.ldk.structs.EntropySource entropy_source) { - byte[] ret = bindings.BuiltCommitmentTransaction_sign_holder_commitment(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis, entropy_source.ptr); + long ret = bindings.BuiltCommitmentTransaction_sign_holder_commitment(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_key, 32)), InternalUtils.encodeUint8Array(funding_redeemscript), channel_value_satoshis, entropy_source.ptr); GC.KeepAlive(this); GC.KeepAlive(funding_key); GC.KeepAlive(funding_redeemscript); GC.KeepAlive(channel_value_satoshis); GC.KeepAlive(entropy_source); + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); if (this != null) { this.ptrs_to.AddLast(entropy_source); }; - return ret; + return ret_conv; } }