1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Chain-related parameters used to construct a new `ChannelManager`.
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`.
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 {
22 if (ptr != 0) { bindings.ChainParameters_free(ptr); }
26 * The network for determining the `chain_hash` in Lightning messages.
28 public LDKNetwork get_network() {
29 LDKNetwork ret = bindings.ChainParameters_get_network(this.ptr);
34 * The network for determining the `chain_hash` in Lightning messages.
36 public void set_network(LDKNetwork val) {
37 bindings.ChainParameters_set_network(this.ptr, val);
41 * The hash of the latest block successfully connected.
43 public byte[] get_latest_hash() {
44 byte[] ret = bindings.ChainParameters_get_latest_hash(this.ptr);
49 * The hash of the latest block successfully connected.
51 public void set_latest_hash(byte[] val) {
52 bindings.ChainParameters_set_latest_hash(this.ptr, val);
56 * The height of the latest block successfully connected.
58 * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
60 public long get_latest_height() {
61 long ret = bindings.ChainParameters_get_latest_height(this.ptr);
66 * The height of the latest block successfully connected.
68 * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
70 public void set_latest_height(long val) {
71 bindings.ChainParameters_set_latest_height(this.ptr, val);
75 * Constructs a new ChainParameters given each field
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);