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_complete message signalling the conclusion of a peer's transaction contributions during
13 * interactive transaction construction.
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxComplete extends CommonBase {
17 TxComplete(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.TxComplete_free(ptr); }
27 public ChannelId get_channel_id() {
28 long ret = bindings.TxComplete_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.TxComplete_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 * Constructs a new TxComplete given each field
49 public static TxComplete of(org.ldk.structs.ChannelId channel_id_arg) {
50 long ret = bindings.TxComplete_new(channel_id_arg.ptr);
51 Reference.reachabilityFence(channel_id_arg);
52 if (ret >= 0 && ret <= 4096) { return null; }
53 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
54 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
55 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
60 long ret = bindings.TxComplete_clone_ptr(this.ptr);
61 Reference.reachabilityFence(this);
66 * Creates a copy of the TxComplete
68 public TxComplete clone() {
69 long ret = bindings.TxComplete_clone(this.ptr);
70 Reference.reachabilityFence(this);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
78 * Generates a non-cryptographic 64-bit hash of the TxComplete.
81 long ret = bindings.TxComplete_hash(this.ptr);
82 Reference.reachabilityFence(this);
86 @Override public int hashCode() {
87 return (int)this.hash();
90 * Checks if two TxCompletes contain equal inner contents.
91 * This ignores pointers and is_owned flags and looks at the values in fields.
92 * Two objects with NULL inner values will be considered "equal" here.
94 public boolean eq(org.ldk.structs.TxComplete b) {
95 boolean ret = bindings.TxComplete_eq(this.ptr, b.ptr);
96 Reference.reachabilityFence(this);
97 Reference.reachabilityFence(b);
98 if (this != null) { this.ptrs_to.add(b); };
102 @Override public boolean equals(Object o) {
103 if (!(o instanceof TxComplete)) return false;
104 return this.eq((TxComplete)o);
107 * Serialize the TxComplete object into a byte array which can be read by TxComplete_read
109 public byte[] write() {
110 byte[] ret = bindings.TxComplete_write(this.ptr);
111 Reference.reachabilityFence(this);
116 * Read a TxComplete from a byte array, created by TxComplete_write
118 public static Result_TxCompleteDecodeErrorZ read(byte[] ser) {
119 long ret = bindings.TxComplete_read(ser);
120 Reference.reachabilityFence(ser);
121 if (ret >= 0 && ret <= 4096) { return null; }
122 Result_TxCompleteDecodeErrorZ ret_hu_conv = Result_TxCompleteDecodeErrorZ.constr_from_ptr(ret);