X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FHTLCDestination.cs;h=c8ebe79d795507fbb4b0c32ecd12c4be3be71a7b;hp=b5313735af5a7b3348ac2e7f592c11d2e953cd2e;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hpb=afc50e5d491a11364849383b75a8f939df703bac diff --git a/c_sharp/src/org/ldk/structs/HTLCDestination.cs b/c_sharp/src/org/ldk/structs/HTLCDestination.cs index b5313735..c8ebe79d 100644 --- a/c_sharp/src/org/ldk/structs/HTLCDestination.cs +++ b/c_sharp/src/org/ldk/structs/HTLCDestination.cs @@ -41,8 +41,12 @@ public class HTLCDestination : CommonBase { */ public byte[] channel_id; internal HTLCDestination_NextHopChannel(long ptr) : base(null, ptr) { - this.node_id = bindings.LDKHTLCDestination_NextHopChannel_get_node_id(ptr); - this.channel_id = bindings.LDKHTLCDestination_NextHopChannel_get_channel_id(ptr); + long node_id = bindings.LDKHTLCDestination_NextHopChannel_get_node_id(ptr); + byte[] node_id_conv = InternalUtils.decodeUint8Array(node_id); + this.node_id = node_id_conv; + long channel_id = bindings.LDKHTLCDestination_NextHopChannel_get_channel_id(ptr); + byte[] channel_id_conv = InternalUtils.decodeUint8Array(channel_id); + this.channel_id = channel_id_conv; } } /** A HTLCDestination of type UnknownNextHop */ @@ -72,7 +76,9 @@ public class HTLCDestination : CommonBase { */ public byte[] payment_hash; internal HTLCDestination_FailedPayment(long ptr) : base(null, ptr) { - this.payment_hash = bindings.LDKHTLCDestination_FailedPayment_get_payment_hash(ptr); + long payment_hash = bindings.LDKHTLCDestination_FailedPayment_get_payment_hash(ptr); + byte[] payment_hash_conv = InternalUtils.decodeUint8Array(payment_hash); + this.payment_hash = payment_hash_conv; } } internal long clone_ptr() { @@ -97,7 +103,7 @@ public class HTLCDestination : CommonBase { * Utility method to constructs a new NextHopChannel-variant HTLCDestination */ public static HTLCDestination next_hop_channel(byte[] node_id, byte[] channel_id) { - long ret = bindings.HTLCDestination_next_hop_channel(InternalUtils.check_arr_len(node_id, 33), InternalUtils.check_arr_len(channel_id, 32)); + long ret = bindings.HTLCDestination_next_hop_channel(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(node_id, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id, 32))); GC.KeepAlive(node_id); GC.KeepAlive(channel_id); if (ret >= 0 && ret <= 4096) { return null; } @@ -134,7 +140,7 @@ public class HTLCDestination : CommonBase { * Utility method to constructs a new FailedPayment-variant HTLCDestination */ public static HTLCDestination failed_payment(byte[] payment_hash) { - long ret = bindings.HTLCDestination_failed_payment(InternalUtils.check_arr_len(payment_hash, 32)); + long ret = bindings.HTLCDestination_failed_payment(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32))); GC.KeepAlive(payment_hash); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.HTLCDestination ret_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(ret); @@ -161,9 +167,11 @@ public class HTLCDestination : CommonBase { * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read */ public byte[] write() { - byte[] ret = bindings.HTLCDestination_write(this.ptr); + long ret = bindings.HTLCDestination_write(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } }