X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FTransactionU16LenLimited.cs;h=9e0974ca7007a3baa4744165451d828b65c3f39a;hb=152d721883552dd92925833d15687d7d64d01c35;hp=a22f14798d73eabd7cad28d2d933594d14fa02f4;hpb=7811d2191440c55034e1abfbf3be442d4b25481b;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/TransactionU16LenLimited.cs b/c_sharp/src/org/ldk/structs/TransactionU16LenLimited.cs index a22f1479..9e0974ca 100644 --- a/c_sharp/src/org/ldk/structs/TransactionU16LenLimited.cs +++ b/c_sharp/src/org/ldk/structs/TransactionU16LenLimited.cs @@ -36,13 +36,25 @@ public class TransactionU16LenLimited : CommonBase { return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited. + */ + public long hash() { + long ret = bindings.TransactionU16LenLimited_hash(this.ptr); + GC.KeepAlive(this); + return ret; + } + + public override int GetHashCode() { + return (int)this.hash(); + } /** * Checks if two TransactionU16LenLimiteds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ public bool eq(org.ldk.structs.TransactionU16LenLimited b) { - bool ret = bindings.TransactionU16LenLimited_eq(this.ptr, b == null ? 0 : b.ptr); + bool ret = bindings.TransactionU16LenLimited_eq(this.ptr, b.ptr); GC.KeepAlive(this); GC.KeepAlive(b); if (this != null) { this.ptrs_to.AddLast(b); }; @@ -58,7 +70,7 @@ public class TransactionU16LenLimited : CommonBase { * serialized length is <= u16::MAX. */ public static Result_TransactionU16LenLimitedNoneZ of(byte[] transaction) { - long ret = bindings.TransactionU16LenLimited_new(transaction); + long ret = bindings.TransactionU16LenLimited_new(InternalUtils.encodeUint8Array(transaction)); GC.KeepAlive(transaction); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionU16LenLimitedNoneZ ret_hu_conv = Result_TransactionU16LenLimitedNoneZ.constr_from_ptr(ret); @@ -69,26 +81,41 @@ public class TransactionU16LenLimited : CommonBase { * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`. */ public byte[] into_transaction() { - byte[] ret = bindings.TransactionU16LenLimited_into_transaction(this.ptr); + long ret = bindings.TransactionU16LenLimited_into_transaction(this.ptr); GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); if (this != null) { this.ptrs_to.AddLast(this); }; - return ret; + return ret_conv; + } + + /** + * Returns a reference to the contained `Transaction` + */ + public byte[] as_transaction() { + long ret = bindings.TransactionU16LenLimited_as_transaction(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read */ public byte[] write() { - byte[] ret = bindings.TransactionU16LenLimited_write(this.ptr); + long ret = bindings.TransactionU16LenLimited_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 TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write */ public static Result_TransactionU16LenLimitedDecodeErrorZ read(byte[] ser) { - long ret = bindings.TransactionU16LenLimited_read(ser); + long ret = bindings.TransactionU16LenLimited_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionU16LenLimitedDecodeErrorZ ret_hu_conv = Result_TransactionU16LenLimitedDecodeErrorZ.constr_from_ptr(ret);