Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / DataLossProtect.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 import javax.annotation.Nullable;
8
9
10 /**
11  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
12  * This is used to convince the recipient that the channel is at a certain commitment
13  * number even if they lost that data due to a local failure.  Of course, the peer may lie
14  * and even later commitments may have been revoked.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class DataLossProtect extends CommonBase {
18         DataLossProtect(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.DataLossProtect_free(ptr); }
23         }
24
25         /**
26          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
27          * belonging to the recipient
28          */
29         public byte[] get_your_last_per_commitment_secret() {
30                 byte[] ret = bindings.DataLossProtect_get_your_last_per_commitment_secret(this.ptr);
31                 return ret;
32         }
33
34         /**
35          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
36          * belonging to the recipient
37          */
38         public void set_your_last_per_commitment_secret(byte[] val) {
39                 bindings.DataLossProtect_set_your_last_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
40         }
41
42         /**
43          * The sender's per-commitment point for their current commitment transaction
44          */
45         public byte[] get_my_current_per_commitment_point() {
46                 byte[] ret = bindings.DataLossProtect_get_my_current_per_commitment_point(this.ptr);
47                 return ret;
48         }
49
50         /**
51          * The sender's per-commitment point for their current commitment transaction
52          */
53         public void set_my_current_per_commitment_point(byte[] val) {
54                 bindings.DataLossProtect_set_my_current_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
55         }
56
57         /**
58          * Constructs a new DataLossProtect given each field
59          */
60         public static DataLossProtect of(byte[] your_last_per_commitment_secret_arg, byte[] my_current_per_commitment_point_arg) {
61                 long ret = bindings.DataLossProtect_new(InternalUtils.check_arr_len(your_last_per_commitment_secret_arg, 32), InternalUtils.check_arr_len(my_current_per_commitment_point_arg, 33));
62                 if (ret >= 0 && ret <= 4096) { return null; }
63                 DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DataLossProtect(null, ret); }
64                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
65                 return ret_hu_conv;
66         }
67
68         long clone_ptr() {
69                 long ret = bindings.DataLossProtect_clone_ptr(this.ptr);
70                 return ret;
71         }
72
73         /**
74          * Creates a copy of the DataLossProtect
75          */
76         public DataLossProtect clone() {
77                 long ret = bindings.DataLossProtect_clone(this.ptr);
78                 if (ret >= 0 && ret <= 4096) { return null; }
79                 DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DataLossProtect(null, ret); }
80                 ret_hu_conv.ptrs_to.add(this);
81                 return ret_hu_conv;
82         }
83
84 }