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 ChannelId get_channel_id() {
28 long ret = bindings.TxAckRbf_get_channel_id(this.ptr);
29 Reference.reachabilityFence(this);
30 if (ret >= 0 && ret <= 4096) { return null; }
31 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
32 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
39 public void set_channel_id(org.ldk.structs.ChannelId val) {
40 bindings.TxAckRbf_set_channel_id(this.ptr, val.ptr);
41 Reference.reachabilityFence(this);
42 Reference.reachabilityFence(val);
43 if (this != null) { this.ptrs_to.add(val); };
47 * The number of satoshis the sender will contribute to or, if negative, remove from
48 * (e.g. splice-out) the funding output of the transaction
50 public Option_i64Z get_funding_output_contribution() {
51 long ret = bindings.TxAckRbf_get_funding_output_contribution(this.ptr);
52 Reference.reachabilityFence(this);
53 if (ret >= 0 && ret <= 4096) { return null; }
54 org.ldk.structs.Option_i64Z ret_hu_conv = org.ldk.structs.Option_i64Z.constr_from_ptr(ret);
55 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
60 * The number of satoshis the sender will contribute to or, if negative, remove from
61 * (e.g. splice-out) the funding output of the transaction
63 public void set_funding_output_contribution(org.ldk.structs.Option_i64Z val) {
64 bindings.TxAckRbf_set_funding_output_contribution(this.ptr, val.ptr);
65 Reference.reachabilityFence(this);
66 Reference.reachabilityFence(val);
67 if (this != null) { this.ptrs_to.add(val); };
71 * Constructs a new TxAckRbf given each field
73 public static TxAckRbf of(org.ldk.structs.ChannelId channel_id_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) {
74 long ret = bindings.TxAckRbf_new(channel_id_arg.ptr, funding_output_contribution_arg.ptr);
75 Reference.reachabilityFence(channel_id_arg);
76 Reference.reachabilityFence(funding_output_contribution_arg);
77 if (ret >= 0 && ret <= 4096) { return null; }
78 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
79 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
81 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_output_contribution_arg); };
86 long ret = bindings.TxAckRbf_clone_ptr(this.ptr);
87 Reference.reachabilityFence(this);
92 * Creates a copy of the TxAckRbf
94 public TxAckRbf clone() {
95 long ret = bindings.TxAckRbf_clone(this.ptr);
96 Reference.reachabilityFence(this);
97 if (ret >= 0 && ret <= 4096) { return null; }
98 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
99 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
104 * Generates a non-cryptographic 64-bit hash of the TxAckRbf.
107 long ret = bindings.TxAckRbf_hash(this.ptr);
108 Reference.reachabilityFence(this);
112 @Override public int hashCode() {
113 return (int)this.hash();
116 * Checks if two TxAckRbfs contain equal inner contents.
117 * This ignores pointers and is_owned flags and looks at the values in fields.
118 * Two objects with NULL inner values will be considered "equal" here.
120 public boolean eq(org.ldk.structs.TxAckRbf b) {
121 boolean ret = bindings.TxAckRbf_eq(this.ptr, b.ptr);
122 Reference.reachabilityFence(this);
123 Reference.reachabilityFence(b);
124 if (this != null) { this.ptrs_to.add(b); };
128 @Override public boolean equals(Object o) {
129 if (!(o instanceof TxAckRbf)) return false;
130 return this.eq((TxAckRbf)o);
133 * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read
135 public byte[] write() {
136 byte[] ret = bindings.TxAckRbf_write(this.ptr);
137 Reference.reachabilityFence(this);
142 * Read a TxAckRbf from a byte array, created by TxAckRbf_write
144 public static Result_TxAckRbfDecodeErrorZ read(byte[] ser) {
145 long ret = bindings.TxAckRbf_read(ser);
146 Reference.reachabilityFence(ser);
147 if (ret >= 0 && ret <= 4096) { return null; }
148 Result_TxAckRbfDecodeErrorZ ret_hu_conv = Result_TxAckRbfDecodeErrorZ.constr_from_ptr(ret);