X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FHTLCDescriptor.java;fp=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FHTLCDescriptor.java;h=50fddf0c76d71273a5a1a881fddfca842be4532f;hb=07d5d868dfe064aadb28a7f7ca6002c16be9723d;hp=91319a3bd51215376639bb915d6a9a2f0a828faf;hpb=32973ea2749f8efd05b543dd774763513013b38b;p=ldk-java diff --git a/src/main/java/org/ldk/structs/HTLCDescriptor.java b/src/main/java/org/ldk/structs/HTLCDescriptor.java index 91319a3b..50fddf0c 100644 --- a/src/main/java/org/ldk/structs/HTLCDescriptor.java +++ b/src/main/java/org/ldk/structs/HTLCDescriptor.java @@ -112,11 +112,11 @@ public class HTLCDescriptor extends CommonBase { * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be * taken. */ - public Option_PaymentPreimageZ get_preimage() { + public Option_ThirtyTwoBytesZ get_preimage() { long ret = bindings.HTLCDescriptor_get_preimage(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_PaymentPreimageZ ret_hu_conv = org.ldk.structs.Option_PaymentPreimageZ.constr_from_ptr(ret); + org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -125,7 +125,7 @@ public class HTLCDescriptor extends CommonBase { * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be * taken. */ - public void set_preimage(org.ldk.structs.Option_PaymentPreimageZ val) { + public void set_preimage(org.ldk.structs.Option_ThirtyTwoBytesZ val) { bindings.HTLCDescriptor_set_preimage(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); @@ -185,6 +185,26 @@ public class HTLCDescriptor extends CommonBase { if (!(o instanceof HTLCDescriptor)) return false; return this.eq((HTLCDescriptor)o); } + /** + * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read + */ + public byte[] write() { + byte[] ret = bindings.HTLCDescriptor_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write + */ + public static Result_HTLCDescriptorDecodeErrorZ read(byte[] ser) { + long ret = bindings.HTLCDescriptor_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_HTLCDescriptorDecodeErrorZ ret_hu_conv = Result_HTLCDescriptorDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint * being spent by the HTLC input in the HTLC transaction.