X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FTxAckRbf.cs;h=52362a53b75710d48a4ac49b4dd8af3b4907bb03;hb=152d721883552dd92925833d15687d7d64d01c35;hp=42811918f71422e7783c54fce65732bf940356e7;hpb=7811d2191440c55034e1abfbf3be442d4b25481b;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/TxAckRbf.cs b/c_sharp/src/org/ldk/structs/TxAckRbf.cs index 42811918..52362a53 100644 --- a/c_sharp/src/org/ldk/structs/TxAckRbf.cs +++ b/c_sharp/src/org/ldk/structs/TxAckRbf.cs @@ -19,19 +19,23 @@ public class TxAckRbf : CommonBase { /** * The channel ID */ - public byte[] get_channel_id() { - byte[] ret = bindings.TxAckRbf_get_channel_id(this.ptr); + public ChannelId get_channel_id() { + long ret = bindings.TxAckRbf_get_channel_id(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); }; + return ret_hu_conv; } /** * The channel ID */ - public void set_channel_id(byte[] val) { - bindings.TxAckRbf_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + public void set_channel_id(org.ldk.structs.ChannelId val) { + bindings.TxAckRbf_set_channel_id(this.ptr, val.ptr); GC.KeepAlive(this); GC.KeepAlive(val); + if (this != null) { this.ptrs_to.AddLast(val); }; } /** @@ -61,13 +65,14 @@ public class TxAckRbf : CommonBase { /** * Constructs a new TxAckRbf given each field */ - public static TxAckRbf of(byte[] channel_id_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) { - long ret = bindings.TxAckRbf_new(InternalUtils.check_arr_len(channel_id_arg, 32), funding_output_contribution_arg.ptr); + public static TxAckRbf of(org.ldk.structs.ChannelId channel_id_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) { + long ret = bindings.TxAckRbf_new(channel_id_arg.ptr, funding_output_contribution_arg.ptr); GC.KeepAlive(channel_id_arg); GC.KeepAlive(funding_output_contribution_arg); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_output_contribution_arg); }; return ret_hu_conv; } @@ -90,13 +95,25 @@ public class TxAckRbf : CommonBase { return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the TxAckRbf. + */ + public long hash() { + long ret = bindings.TxAckRbf_hash(this.ptr); + GC.KeepAlive(this); + return ret; + } + + public override int GetHashCode() { + return (int)this.hash(); + } /** * Checks if two TxAckRbfs 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.TxAckRbf b) { - bool ret = bindings.TxAckRbf_eq(this.ptr, b == null ? 0 : b.ptr); + bool ret = bindings.TxAckRbf_eq(this.ptr, b.ptr); GC.KeepAlive(this); GC.KeepAlive(b); if (this != null) { this.ptrs_to.AddLast(b); }; @@ -111,16 +128,18 @@ public class TxAckRbf : CommonBase { * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read */ public byte[] write() { - byte[] ret = bindings.TxAckRbf_write(this.ptr); + long ret = bindings.TxAckRbf_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 TxAckRbf from a byte array, created by TxAckRbf_write */ public static Result_TxAckRbfDecodeErrorZ read(byte[] ser) { - long ret = bindings.TxAckRbf_read(ser); + long ret = bindings.TxAckRbf_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_TxAckRbfDecodeErrorZ ret_hu_conv = Result_TxAckRbfDecodeErrorZ.constr_from_ptr(ret);