[Java] Print error stack trace when tests fail
[ldk-java] / src / main / java / org / ldk / structs / ChainParameters.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  * Chain-related parameters used to construct a new `ChannelManager`.
13  * 
14  * Typically, the block-specific parameters are derived from the best block hash for the network,
15  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
16  * are not needed when deserializing a previously constructed `ChannelManager`.
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class ChainParameters extends CommonBase {
20         ChainParameters(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.ChainParameters_free(ptr); }
25         }
26
27         /**
28          * The network for determining the `chain_hash` in Lightning messages.
29          */
30         public Network get_network() {
31                 Network ret = bindings.ChainParameters_get_network(this.ptr);
32                 Reference.reachabilityFence(this);
33                 return ret;
34         }
35
36         /**
37          * The network for determining the `chain_hash` in Lightning messages.
38          */
39         public void set_network(org.ldk.enums.Network val) {
40                 bindings.ChainParameters_set_network(this.ptr, val);
41                 Reference.reachabilityFence(this);
42                 Reference.reachabilityFence(val);
43         }
44
45         /**
46          * The hash and height of the latest block successfully connected.
47          * 
48          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
49          */
50         public BestBlock get_best_block() {
51                 long ret = bindings.ChainParameters_get_best_block(this.ptr);
52                 Reference.reachabilityFence(this);
53                 if (ret >= 0 && ret <= 4096) { return null; }
54                 org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BestBlock(null, ret); }
55                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
56                 return ret_hu_conv;
57         }
58
59         /**
60          * The hash and height of the latest block successfully connected.
61          * 
62          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
63          */
64         public void set_best_block(org.ldk.structs.BestBlock val) {
65                 bindings.ChainParameters_set_best_block(this.ptr, val.ptr);
66                 Reference.reachabilityFence(this);
67                 Reference.reachabilityFence(val);
68                 if (this != null) { this.ptrs_to.add(val); };
69         }
70
71         /**
72          * Constructs a new ChainParameters given each field
73          */
74         public static ChainParameters of(org.ldk.enums.Network network_arg, org.ldk.structs.BestBlock best_block_arg) {
75                 long ret = bindings.ChainParameters_new(network_arg, best_block_arg.ptr);
76                 Reference.reachabilityFence(network_arg);
77                 Reference.reachabilityFence(best_block_arg);
78                 if (ret >= 0 && ret <= 4096) { return null; }
79                 org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
80                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
81                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(best_block_arg); };
82                 return ret_hu_conv;
83         }
84
85         long clone_ptr() {
86                 long ret = bindings.ChainParameters_clone_ptr(this.ptr);
87                 Reference.reachabilityFence(this);
88                 return ret;
89         }
90
91         /**
92          * Creates a copy of the ChainParameters
93          */
94         public ChainParameters clone() {
95                 long ret = bindings.ChainParameters_clone(this.ptr);
96                 Reference.reachabilityFence(this);
97                 if (ret >= 0 && ret <= 4096) { return null; }
98                 org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
99                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
100                 return ret_hu_conv;
101         }
102
103 }