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 tx_ack_rbf message which acknowledges replacement of the transaction after it's been
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxAckRbf extends CommonBase {
17 TxAckRbf(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.TxAckRbf_free(ptr); }
27 public byte[] get_channel_id() {
28 byte[] ret = bindings.TxAckRbf_get_channel_id(this.ptr);
29 Reference.reachabilityFence(this);
36 public void set_channel_id(byte[] val) {
37 bindings.TxAckRbf_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
38 Reference.reachabilityFence(this);
39 Reference.reachabilityFence(val);
43 * The number of satoshis the sender will contribute to or, if negative, remove from
44 * (e.g. splice-out) the funding output of the transaction
46 public Option_i64Z get_funding_output_contribution() {
47 long ret = bindings.TxAckRbf_get_funding_output_contribution(this.ptr);
48 Reference.reachabilityFence(this);
49 if (ret >= 0 && ret <= 4096) { return null; }
50 org.ldk.structs.Option_i64Z ret_hu_conv = org.ldk.structs.Option_i64Z.constr_from_ptr(ret);
51 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
56 * The number of satoshis the sender will contribute to or, if negative, remove from
57 * (e.g. splice-out) the funding output of the transaction
59 public void set_funding_output_contribution(org.ldk.structs.Option_i64Z val) {
60 bindings.TxAckRbf_set_funding_output_contribution(this.ptr, val.ptr);
61 Reference.reachabilityFence(this);
62 Reference.reachabilityFence(val);
63 if (this != null) { this.ptrs_to.add(val); };
67 * Constructs a new TxAckRbf given each field
69 public static TxAckRbf of(byte[] channel_id_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) {
70 long ret = bindings.TxAckRbf_new(InternalUtils.check_arr_len(channel_id_arg, 32), funding_output_contribution_arg.ptr);
71 Reference.reachabilityFence(channel_id_arg);
72 Reference.reachabilityFence(funding_output_contribution_arg);
73 if (ret >= 0 && ret <= 4096) { return null; }
74 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
75 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
76 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_output_contribution_arg); };
81 long ret = bindings.TxAckRbf_clone_ptr(this.ptr);
82 Reference.reachabilityFence(this);
87 * Creates a copy of the TxAckRbf
89 public TxAckRbf clone() {
90 long ret = bindings.TxAckRbf_clone(this.ptr);
91 Reference.reachabilityFence(this);
92 if (ret >= 0 && ret <= 4096) { return null; }
93 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
99 * Checks if two TxAckRbfs contain equal inner contents.
100 * This ignores pointers and is_owned flags and looks at the values in fields.
101 * Two objects with NULL inner values will be considered "equal" here.
103 public boolean eq(org.ldk.structs.TxAckRbf b) {
104 boolean ret = bindings.TxAckRbf_eq(this.ptr, b == null ? 0 : b.ptr);
105 Reference.reachabilityFence(this);
106 Reference.reachabilityFence(b);
107 if (this != null) { this.ptrs_to.add(b); };
111 @Override public boolean equals(Object o) {
112 if (!(o instanceof TxAckRbf)) return false;
113 return this.eq((TxAckRbf)o);
116 * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read
118 public byte[] write() {
119 byte[] ret = bindings.TxAckRbf_write(this.ptr);
120 Reference.reachabilityFence(this);
125 * Read a TxAckRbf from a byte array, created by TxAckRbf_write
127 public static Result_TxAckRbfDecodeErrorZ read(byte[] ser) {
128 long ret = bindings.TxAckRbf_read(ser);
129 Reference.reachabilityFence(ser);
130 if (ret >= 0 && ret <= 4096) { return null; }
131 Result_TxAckRbfDecodeErrorZ ret_hu_conv = Result_TxAckRbfDecodeErrorZ.constr_from_ptr(ret);