6 namespace org { namespace ldk { namespace structs {
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 public class ChainParameters : CommonBase {
17 internal ChainParameters(object _dummy, long ptr) : base(ptr) { }
19 if (ptr != 0) { bindings.ChainParameters_free(ptr); }
23 * The network for determining the `chain_hash` in Lightning messages.
25 public Network get_network() {
26 Network ret = bindings.ChainParameters_get_network(this.ptr);
32 * The network for determining the `chain_hash` in Lightning messages.
34 public void set_network(Network val) {
35 bindings.ChainParameters_set_network(this.ptr, val);
41 * The hash and height of the latest block successfully connected.
43 * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
45 public BestBlock get_best_block() {
46 long ret = bindings.ChainParameters_get_best_block(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BestBlock(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
55 * The hash and height of the latest block successfully connected.
57 * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
59 public void set_best_block(org.ldk.structs.BestBlock val) {
60 bindings.ChainParameters_set_best_block(this.ptr, val.ptr);
63 if (this != null) { this.ptrs_to.AddLast(val); };
67 * Constructs a new ChainParameters given each field
69 public static ChainParameters of(Network network_arg, org.ldk.structs.BestBlock best_block_arg) {
70 long ret = bindings.ChainParameters_new(network_arg, best_block_arg.ptr);
71 GC.KeepAlive(network_arg);
72 GC.KeepAlive(best_block_arg);
73 if (ret >= 0 && ret <= 4096) { return null; }
74 org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
75 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
76 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(best_block_arg); };
80 internal long clone_ptr() {
81 long ret = bindings.ChainParameters_clone_ptr(this.ptr);
87 * Creates a copy of the ChainParameters
89 public ChainParameters clone() {
90 long ret = bindings.ChainParameters_clone(this.ptr);
92 if (ret >= 0 && ret <= 4096) { return null; }
93 org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };