[Java] Print error stack trace when tests fail
[ldk-java] / src / main / java / org / ldk / structs / FundingCreated.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 [`funding_created`] message to be sent to or received from a peer.
13  * 
14  * Used in V1 channel establishment
15  * 
16  * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class FundingCreated extends CommonBase {
20         FundingCreated(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.FundingCreated_free(ptr); }
25         }
26
27         /**
28          * A temporary channel ID, until the funding is established
29          */
30         public ChannelId get_temporary_channel_id() {
31                 long ret = bindings.FundingCreated_get_temporary_channel_id(this.ptr);
32                 Reference.reachabilityFence(this);
33                 if (ret >= 0 && ret <= 4096) { return null; }
34                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
35                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
36                 return ret_hu_conv;
37         }
38
39         /**
40          * A temporary channel ID, until the funding is established
41          */
42         public void set_temporary_channel_id(org.ldk.structs.ChannelId val) {
43                 bindings.FundingCreated_set_temporary_channel_id(this.ptr, val.ptr);
44                 Reference.reachabilityFence(this);
45                 Reference.reachabilityFence(val);
46                 if (this != null) { this.ptrs_to.add(val); };
47         }
48
49         /**
50          * The funding transaction ID
51          */
52         public byte[] get_funding_txid() {
53                 byte[] ret = bindings.FundingCreated_get_funding_txid(this.ptr);
54                 Reference.reachabilityFence(this);
55                 return ret;
56         }
57
58         /**
59          * The funding transaction ID
60          */
61         public void set_funding_txid(byte[] val) {
62                 bindings.FundingCreated_set_funding_txid(this.ptr, InternalUtils.check_arr_len(val, 32));
63                 Reference.reachabilityFence(this);
64                 Reference.reachabilityFence(val);
65         }
66
67         /**
68          * The specific output index funding this channel
69          */
70         public short get_funding_output_index() {
71                 short ret = bindings.FundingCreated_get_funding_output_index(this.ptr);
72                 Reference.reachabilityFence(this);
73                 return ret;
74         }
75
76         /**
77          * The specific output index funding this channel
78          */
79         public void set_funding_output_index(short val) {
80                 bindings.FundingCreated_set_funding_output_index(this.ptr, val);
81                 Reference.reachabilityFence(this);
82                 Reference.reachabilityFence(val);
83         }
84
85         /**
86          * The signature of the channel initiator (funder) on the initial commitment transaction
87          */
88         public byte[] get_signature() {
89                 byte[] ret = bindings.FundingCreated_get_signature(this.ptr);
90                 Reference.reachabilityFence(this);
91                 return ret;
92         }
93
94         /**
95          * The signature of the channel initiator (funder) on the initial commitment transaction
96          */
97         public void set_signature(byte[] val) {
98                 bindings.FundingCreated_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
99                 Reference.reachabilityFence(this);
100                 Reference.reachabilityFence(val);
101         }
102
103         /**
104          * Constructs a new FundingCreated given each field
105          */
106         public static FundingCreated of(org.ldk.structs.ChannelId temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, byte[] signature_arg) {
107                 long ret = bindings.FundingCreated_new(temporary_channel_id_arg.ptr, InternalUtils.check_arr_len(funding_txid_arg, 32), funding_output_index_arg, InternalUtils.check_arr_len(signature_arg, 64));
108                 Reference.reachabilityFence(temporary_channel_id_arg);
109                 Reference.reachabilityFence(funding_txid_arg);
110                 Reference.reachabilityFence(funding_output_index_arg);
111                 Reference.reachabilityFence(signature_arg);
112                 if (ret >= 0 && ret <= 4096) { return null; }
113                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
115                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(temporary_channel_id_arg); };
116                 return ret_hu_conv;
117         }
118
119         long clone_ptr() {
120                 long ret = bindings.FundingCreated_clone_ptr(this.ptr);
121                 Reference.reachabilityFence(this);
122                 return ret;
123         }
124
125         /**
126          * Creates a copy of the FundingCreated
127          */
128         public FundingCreated clone() {
129                 long ret = bindings.FundingCreated_clone(this.ptr);
130                 Reference.reachabilityFence(this);
131                 if (ret >= 0 && ret <= 4096) { return null; }
132                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
133                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
134                 return ret_hu_conv;
135         }
136
137         /**
138          * Generates a non-cryptographic 64-bit hash of the FundingCreated.
139          */
140         public long hash() {
141                 long ret = bindings.FundingCreated_hash(this.ptr);
142                 Reference.reachabilityFence(this);
143                 return ret;
144         }
145
146         @Override public int hashCode() {
147                 return (int)this.hash();
148         }
149         /**
150          * Checks if two FundingCreateds contain equal inner contents.
151          * This ignores pointers and is_owned flags and looks at the values in fields.
152          * Two objects with NULL inner values will be considered "equal" here.
153          */
154         public boolean eq(org.ldk.structs.FundingCreated b) {
155                 boolean ret = bindings.FundingCreated_eq(this.ptr, b.ptr);
156                 Reference.reachabilityFence(this);
157                 Reference.reachabilityFence(b);
158                 if (this != null) { this.ptrs_to.add(b); };
159                 return ret;
160         }
161
162         @Override public boolean equals(Object o) {
163                 if (!(o instanceof FundingCreated)) return false;
164                 return this.eq((FundingCreated)o);
165         }
166         /**
167          * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
168          */
169         public byte[] write() {
170                 byte[] ret = bindings.FundingCreated_write(this.ptr);
171                 Reference.reachabilityFence(this);
172                 return ret;
173         }
174
175         /**
176          * Read a FundingCreated from a byte array, created by FundingCreated_write
177          */
178         public static Result_FundingCreatedDecodeErrorZ read(byte[] ser) {
179                 long ret = bindings.FundingCreated_read(ser);
180                 Reference.reachabilityFence(ser);
181                 if (ret >= 0 && ret <= 4096) { return null; }
182                 Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret);
183                 return ret_hu_conv;
184         }
185
186 }