Update java bindings with new generator and new upstream code
[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
8
9 /**
10  * Chain-related parameters used to construct a new `ChannelManager`.
11  * 
12  * Typically, the block-specific parameters are derived from the best block hash for the network,
13  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
14  * are not needed when deserializing a previously constructed `ChannelManager`.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class ChainParameters extends CommonBase {
18         ChainParameters(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.ChainParameters_free(ptr); }
23         }
24
25         /**
26          * The network for determining the `chain_hash` in Lightning messages.
27          */
28         public LDKNetwork get_network() {
29                 LDKNetwork ret = bindings.ChainParameters_get_network(this.ptr);
30                 return ret;
31         }
32
33         /**
34          * The network for determining the `chain_hash` in Lightning messages.
35          */
36         public void set_network(LDKNetwork val) {
37                 bindings.ChainParameters_set_network(this.ptr, val);
38         }
39
40         /**
41          * The hash of the latest block successfully connected.
42          */
43         public byte[] get_latest_hash() {
44                 byte[] ret = bindings.ChainParameters_get_latest_hash(this.ptr);
45                 return ret;
46         }
47
48         /**
49          * The hash of the latest block successfully connected.
50          */
51         public void set_latest_hash(byte[] val) {
52                 bindings.ChainParameters_set_latest_hash(this.ptr, val);
53         }
54
55         /**
56          * The height of the latest block successfully connected.
57          * 
58          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
59          */
60         public long get_latest_height() {
61                 long ret = bindings.ChainParameters_get_latest_height(this.ptr);
62                 return ret;
63         }
64
65         /**
66          * The height of the latest block successfully connected.
67          * 
68          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
69          */
70         public void set_latest_height(long val) {
71                 bindings.ChainParameters_set_latest_height(this.ptr, val);
72         }
73
74         /**
75          * Constructs a new ChainParameters given each field
76          */
77         public static ChainParameters constructor_new(LDKNetwork network_arg, byte[] latest_hash_arg, long latest_height_arg) {
78                 long ret = bindings.ChainParameters_new(network_arg, latest_hash_arg, latest_height_arg);
79                 ChainParameters ret_hu_conv = new ChainParameters(null, ret);
80                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
81                 return ret_hu_conv;
82         }
83
84 }