Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / HTLCUpdate.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8
9 /**
10  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
11  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
12  * preimage claim backward will lead to loss of funds.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class HTLCUpdate extends CommonBase {
16         HTLCUpdate(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.HTLCUpdate_free(ptr); }
21         }
22
23         /**
24          * Creates a copy of the HTLCUpdate
25          */
26         public HTLCUpdate clone() {
27                 long ret = bindings.HTLCUpdate_clone(this.ptr);
28                 if (ret < 1024) { return null; }
29                 HTLCUpdate ret_hu_conv = new HTLCUpdate(null, ret);
30                 ret_hu_conv.ptrs_to.add(this);
31                 return ret_hu_conv;
32         }
33
34         /**
35          * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
36          */
37         public byte[] write() {
38                 byte[] ret = bindings.HTLCUpdate_write(this.ptr);
39                 return ret;
40         }
41
42         /**
43          * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
44          */
45         public static Result_HTLCUpdateDecodeErrorZ read(byte[] ser) {
46                 long ret = bindings.HTLCUpdate_read(ser);
47                 if (ret < 1024) { return null; }
48                 Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret);
49                 return ret_hu_conv;
50         }
51
52 }