Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / RevokeAndACK.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  * A revoke_and_ack message to be sent or received from a peer
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class RevokeAndACK extends CommonBase {
16         RevokeAndACK(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.RevokeAndACK_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public byte[] get_channel_id() {
27                 byte[] ret = bindings.RevokeAndACK_get_channel_id(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * The channel ID
34          */
35         public void set_channel_id(byte[] val) {
36                 bindings.RevokeAndACK_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * The secret corresponding to the per-commitment point
43          */
44         public byte[] get_per_commitment_secret() {
45                 byte[] ret = bindings.RevokeAndACK_get_per_commitment_secret(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * The secret corresponding to the per-commitment point
52          */
53         public void set_per_commitment_secret(byte[] val) {
54                 bindings.RevokeAndACK_set_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * The next sender-broadcast commitment transaction's per-commitment point
61          */
62         public byte[] get_next_per_commitment_point() {
63                 byte[] ret = bindings.RevokeAndACK_get_next_per_commitment_point(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * The next sender-broadcast commitment transaction's per-commitment point
70          */
71         public void set_next_per_commitment_point(byte[] val) {
72                 bindings.RevokeAndACK_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
73                 Reference.reachabilityFence(this);
74                 Reference.reachabilityFence(val);
75         }
76
77         /**
78          * Constructs a new RevokeAndACK given each field
79          */
80         public static RevokeAndACK of(byte[] channel_id_arg, byte[] per_commitment_secret_arg, byte[] next_per_commitment_point_arg) {
81                 long ret = bindings.RevokeAndACK_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(per_commitment_secret_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33));
82                 Reference.reachabilityFence(channel_id_arg);
83                 Reference.reachabilityFence(per_commitment_secret_arg);
84                 Reference.reachabilityFence(next_per_commitment_point_arg);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RevokeAndACK(null, ret); }
87                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
88                 return ret_hu_conv;
89         }
90
91         long clone_ptr() {
92                 long ret = bindings.RevokeAndACK_clone_ptr(this.ptr);
93                 Reference.reachabilityFence(this);
94                 return ret;
95         }
96
97         /**
98          * Creates a copy of the RevokeAndACK
99          */
100         public RevokeAndACK clone() {
101                 long ret = bindings.RevokeAndACK_clone(this.ptr);
102                 Reference.reachabilityFence(this);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RevokeAndACK(null, ret); }
105                 ret_hu_conv.ptrs_to.add(this);
106                 return ret_hu_conv;
107         }
108
109         /**
110          * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
111          */
112         public byte[] write() {
113                 byte[] ret = bindings.RevokeAndACK_write(this.ptr);
114                 Reference.reachabilityFence(this);
115                 return ret;
116         }
117
118         /**
119          * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
120          */
121         public static Result_RevokeAndACKDecodeErrorZ read(byte[] ser) {
122                 long ret = bindings.RevokeAndACK_read(ser);
123                 Reference.reachabilityFence(ser);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret);
126                 return ret_hu_conv;
127         }
128
129 }