X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FChannelCounterparty.cs;h=c994ea6c1eb7973331a418a8f2baf833247730b2;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=58f5710c8406b5ea0827166e4d3cca4764c74dcd;hpb=8aa8a96fc6d8fcdd3fbb419b4b4c12482af14938;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/ChannelCounterparty.cs b/c_sharp/src/org/ldk/structs/ChannelCounterparty.cs index 58f5710c..c994ea6c 100644 --- a/c_sharp/src/org/ldk/structs/ChannelCounterparty.cs +++ b/c_sharp/src/org/ldk/structs/ChannelCounterparty.cs @@ -20,16 +20,18 @@ public class ChannelCounterparty : CommonBase { * The node_id of our counterparty */ public byte[] get_node_id() { - byte[] ret = bindings.ChannelCounterparty_get_node_id(this.ptr); + long ret = bindings.ChannelCounterparty_get_node_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 node_id of our counterparty */ public void set_node_id(byte[] val) { - bindings.ChannelCounterparty_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33)); + bindings.ChannelCounterparty_set_node_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -141,6 +143,7 @@ public class ChannelCounterparty : CommonBase { bindings.ChannelCounterparty_set_outbound_htlc_minimum_msat(this.ptr, val.ptr); GC.KeepAlive(this); GC.KeepAlive(val); + if (this != null) { this.ptrs_to.AddLast(val); }; } /** @@ -162,13 +165,16 @@ public class ChannelCounterparty : CommonBase { bindings.ChannelCounterparty_set_outbound_htlc_maximum_msat(this.ptr, val.ptr); GC.KeepAlive(this); GC.KeepAlive(val); + if (this != null) { this.ptrs_to.AddLast(val); }; } /** * Constructs a new ChannelCounterparty given each field + * + * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ public static ChannelCounterparty of(byte[] node_id_arg, org.ldk.structs.InitFeatures features_arg, long unspendable_punishment_reserve_arg, org.ldk.structs.CounterpartyForwardingInfo forwarding_info_arg, org.ldk.structs.Option_u64Z outbound_htlc_minimum_msat_arg, org.ldk.structs.Option_u64Z outbound_htlc_maximum_msat_arg) { - long ret = bindings.ChannelCounterparty_new(InternalUtils.check_arr_len(node_id_arg, 33), features_arg == null ? 0 : features_arg.ptr, unspendable_punishment_reserve_arg, forwarding_info_arg == null ? 0 : forwarding_info_arg.ptr, outbound_htlc_minimum_msat_arg.ptr, outbound_htlc_maximum_msat_arg.ptr); + long ret = bindings.ChannelCounterparty_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(node_id_arg, 33)), features_arg == null ? 0 : features_arg.ptr, unspendable_punishment_reserve_arg, forwarding_info_arg == null ? 0 : forwarding_info_arg.ptr, outbound_htlc_minimum_msat_arg.ptr, outbound_htlc_maximum_msat_arg.ptr); GC.KeepAlive(node_id_arg); GC.KeepAlive(features_arg); GC.KeepAlive(unspendable_punishment_reserve_arg); @@ -180,6 +186,8 @@ public class ChannelCounterparty : CommonBase { 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(features_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(forwarding_info_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outbound_htlc_minimum_msat_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outbound_htlc_maximum_msat_arg); }; return ret_hu_conv; } @@ -205,16 +213,18 @@ public class ChannelCounterparty : CommonBase { * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read */ public byte[] write() { - byte[] ret = bindings.ChannelCounterparty_write(this.ptr); + long ret = bindings.ChannelCounterparty_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 ChannelCounterparty from a byte array, created by ChannelCounterparty_write */ public static Result_ChannelCounterpartyDecodeErrorZ read(byte[] ser) { - long ret = bindings.ChannelCounterparty_read(ser); + long ret = bindings.ChannelCounterparty_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelCounterpartyDecodeErrorZ ret_hu_conv = Result_ChannelCounterpartyDecodeErrorZ.constr_from_ptr(ret);