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