1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A splice_ack message to be received by or sent to the splice initiator.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class SpliceAck extends CommonBase {
16 SpliceAck(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.SpliceAck_free(ptr); }
24 * The channel ID where splicing is intended
26 public byte[] get_channel_id() {
27 byte[] ret = bindings.SpliceAck_get_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
33 * The channel ID where splicing is intended
35 public void set_channel_id(byte[] val) {
36 bindings.SpliceAck_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * The genesis hash of the blockchain where the channel is intended to be spliced
44 public byte[] get_chain_hash() {
45 byte[] ret = bindings.SpliceAck_get_chain_hash(this.ptr);
46 Reference.reachabilityFence(this);
51 * The genesis hash of the blockchain where the channel is intended to be spliced
53 public void set_chain_hash(byte[] val) {
54 bindings.SpliceAck_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
55 Reference.reachabilityFence(this);
56 Reference.reachabilityFence(val);
60 * The intended change in channel capacity: the amount to be added (positive value)
61 * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
63 public long get_relative_satoshis() {
64 long ret = bindings.SpliceAck_get_relative_satoshis(this.ptr);
65 Reference.reachabilityFence(this);
70 * The intended change in channel capacity: the amount to be added (positive value)
71 * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
73 public void set_relative_satoshis(long val) {
74 bindings.SpliceAck_set_relative_satoshis(this.ptr, val);
75 Reference.reachabilityFence(this);
76 Reference.reachabilityFence(val);
80 * The key of the sender (splice acceptor) controlling the new funding transaction
82 public byte[] get_funding_pubkey() {
83 byte[] ret = bindings.SpliceAck_get_funding_pubkey(this.ptr);
84 Reference.reachabilityFence(this);
89 * The key of the sender (splice acceptor) controlling the new funding transaction
91 public void set_funding_pubkey(byte[] val) {
92 bindings.SpliceAck_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
93 Reference.reachabilityFence(this);
94 Reference.reachabilityFence(val);
98 * Constructs a new SpliceAck given each field
100 public static SpliceAck of(byte[] channel_id_arg, byte[] chain_hash_arg, long relative_satoshis_arg, byte[] funding_pubkey_arg) {
101 long ret = bindings.SpliceAck_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(chain_hash_arg, 32), relative_satoshis_arg, InternalUtils.check_arr_len(funding_pubkey_arg, 33));
102 Reference.reachabilityFence(channel_id_arg);
103 Reference.reachabilityFence(chain_hash_arg);
104 Reference.reachabilityFence(relative_satoshis_arg);
105 Reference.reachabilityFence(funding_pubkey_arg);
106 if (ret >= 0 && ret <= 4096) { return null; }
107 org.ldk.structs.SpliceAck ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceAck(null, ret); }
108 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
113 long ret = bindings.SpliceAck_clone_ptr(this.ptr);
114 Reference.reachabilityFence(this);
119 * Creates a copy of the SpliceAck
121 public SpliceAck clone() {
122 long ret = bindings.SpliceAck_clone(this.ptr);
123 Reference.reachabilityFence(this);
124 if (ret >= 0 && ret <= 4096) { return null; }
125 org.ldk.structs.SpliceAck ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceAck(null, ret); }
126 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
131 * Checks if two SpliceAcks contain equal inner contents.
132 * This ignores pointers and is_owned flags and looks at the values in fields.
133 * Two objects with NULL inner values will be considered "equal" here.
135 public boolean eq(org.ldk.structs.SpliceAck b) {
136 boolean ret = bindings.SpliceAck_eq(this.ptr, b == null ? 0 : b.ptr);
137 Reference.reachabilityFence(this);
138 Reference.reachabilityFence(b);
139 if (this != null) { this.ptrs_to.add(b); };
143 @Override public boolean equals(Object o) {
144 if (!(o instanceof SpliceAck)) return false;
145 return this.eq((SpliceAck)o);
148 * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read
150 public byte[] write() {
151 byte[] ret = bindings.SpliceAck_write(this.ptr);
152 Reference.reachabilityFence(this);
157 * Read a SpliceAck from a byte array, created by SpliceAck_write
159 public static Result_SpliceAckDecodeErrorZ read(byte[] ser) {
160 long ret = bindings.SpliceAck_read(ser);
161 Reference.reachabilityFence(ser);
162 if (ret >= 0 && ret <= 4096) { return null; }
163 Result_SpliceAckDecodeErrorZ ret_hu_conv = Result_SpliceAckDecodeErrorZ.constr_from_ptr(ret);