X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FChannelPublicKeys.cs;h=347c8cf13781dfd9f6bdd6d3cdbad146003b7138;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=4040b54d07274cbb53334474dc449dec5f71c777;hpb=afc50e5d491a11364849383b75a8f939df703bac;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/ChannelPublicKeys.cs b/c_sharp/src/org/ldk/structs/ChannelPublicKeys.cs index 4040b54d..347c8cf1 100644 --- a/c_sharp/src/org/ldk/structs/ChannelPublicKeys.cs +++ b/c_sharp/src/org/ldk/structs/ChannelPublicKeys.cs @@ -20,9 +20,11 @@ public class ChannelPublicKeys : CommonBase { * on-chain channel lock-in 2-of-2 multisig output. */ public byte[] get_funding_pubkey() { - byte[] ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr); + long ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** @@ -30,7 +32,7 @@ public class ChannelPublicKeys : CommonBase { * on-chain channel lock-in 2-of-2 multisig output. */ public void set_funding_pubkey(byte[] val) { - bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -42,9 +44,11 @@ public class ChannelPublicKeys : CommonBase { * states. */ public byte[] get_revocation_basepoint() { - byte[] ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr); + long ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** @@ -54,7 +58,7 @@ public class ChannelPublicKeys : CommonBase { * states. */ public void set_revocation_basepoint(byte[] val) { - bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -65,9 +69,11 @@ public class ChannelPublicKeys : CommonBase { * static across every commitment transaction. */ public byte[] get_payment_point() { - byte[] ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr); + long ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** @@ -76,7 +82,7 @@ public class ChannelPublicKeys : CommonBase { * static across every commitment transaction. */ public void set_payment_point(byte[] val) { - bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -87,9 +93,11 @@ public class ChannelPublicKeys : CommonBase { * after some delay (or can be claimed via the revocation path). */ public byte[] get_delayed_payment_basepoint() { - byte[] ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr); + long ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** @@ -98,7 +106,7 @@ public class ChannelPublicKeys : CommonBase { * after some delay (or can be claimed via the revocation path). */ public void set_delayed_payment_basepoint(byte[] val) { - bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -108,9 +116,11 @@ public class ChannelPublicKeys : CommonBase { * which is used to encumber HTLC-in-flight outputs. */ public byte[] get_htlc_basepoint() { - byte[] ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr); + long ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** @@ -118,7 +128,7 @@ public class ChannelPublicKeys : CommonBase { * which is used to encumber HTLC-in-flight outputs. */ public void set_htlc_basepoint(byte[] val) { - bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -127,7 +137,7 @@ public class ChannelPublicKeys : CommonBase { * Constructs a new ChannelPublicKeys given each field */ public static ChannelPublicKeys of(byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg) { - long ret = bindings.ChannelPublicKeys_new(InternalUtils.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_point_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33)); + long ret = bindings.ChannelPublicKeys_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_point_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(htlc_basepoint_arg, 33))); GC.KeepAlive(funding_pubkey_arg); GC.KeepAlive(revocation_basepoint_arg); GC.KeepAlive(payment_point_arg); @@ -157,6 +167,18 @@ public class ChannelPublicKeys : CommonBase { return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. + */ + public long hash() { + long ret = bindings.ChannelPublicKeys_hash(this.ptr); + GC.KeepAlive(this); + return ret; + } + + public override int GetHashCode() { + return (int)this.hash(); + } /** * Checks if two ChannelPublicKeyss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -178,16 +200,18 @@ public class ChannelPublicKeys : CommonBase { * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read */ public byte[] write() { - byte[] ret = bindings.ChannelPublicKeys_write(this.ptr); + long ret = bindings.ChannelPublicKeys_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 ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write */ public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) { - long ret = bindings.ChannelPublicKeys_read(ser); + long ret = bindings.ChannelPublicKeys_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);