1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
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.
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 {
22 if (ptr != 0) { bindings.DataLossProtect_free(ptr); }
26 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
27 * belonging to the recipient
29 public byte[] get_your_last_per_commitment_secret() {
30 byte[] ret = bindings.DataLossProtect_get_your_last_per_commitment_secret(this.ptr);
35 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
36 * belonging to the recipient
38 public void set_your_last_per_commitment_secret(byte[] val) {
39 bindings.DataLossProtect_set_your_last_per_commitment_secret(this.ptr, val);
43 * The sender's per-commitment point for their current commitment transaction
45 public byte[] get_my_current_per_commitment_point() {
46 byte[] ret = bindings.DataLossProtect_get_my_current_per_commitment_point(this.ptr);
51 * The sender's per-commitment point for their current commitment transaction
53 public void set_my_current_per_commitment_point(byte[] val) {
54 bindings.DataLossProtect_set_my_current_per_commitment_point(this.ptr, val);
58 * Constructs a new DataLossProtect given each field
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(your_last_per_commitment_secret_arg, my_current_per_commitment_point_arg);
62 if (ret < 1024) { return null; }
63 DataLossProtect ret_hu_conv = new DataLossProtect(null, ret);
64 ret_hu_conv.ptrs_to.add(ret_hu_conv);
69 * Creates a copy of the DataLossProtect
71 public DataLossProtect clone() {
72 long ret = bindings.DataLossProtect_clone(this.ptr);
73 if (ret < 1024) { return null; }
74 DataLossProtect ret_hu_conv = new DataLossProtect(null, ret);
75 ret_hu_conv.ptrs_to.add(this);