Update auto-generated bindings
[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 and height of the latest block successfully connected.
42          * 
43          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
44          */
45         public BestBlock get_best_block() {
46                 long ret = bindings.ChainParameters_get_best_block(this.ptr);
47                 BestBlock ret_hu_conv = new BestBlock(null, ret);
48                 ret_hu_conv.ptrs_to.add(this);
49                 return ret_hu_conv;
50         }
51
52         /**
53          * The hash and height of the latest block successfully connected.
54          * 
55          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
56          */
57         public void set_best_block(BestBlock val) {
58                 bindings.ChainParameters_set_best_block(this.ptr, val == null ? 0 : val.ptr & ~1);
59                 this.ptrs_to.add(val);
60         }
61
62         /**
63          * Constructs a new ChainParameters given each field
64          */
65         public static ChainParameters constructor_new(LDKNetwork network_arg, BestBlock best_block_arg) {
66                 long ret = bindings.ChainParameters_new(network_arg, best_block_arg == null ? 0 : best_block_arg.ptr & ~1);
67                 ChainParameters ret_hu_conv = new ChainParameters(null, ret);
68                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
69                 ret_hu_conv.ptrs_to.add(best_block_arg);
70                 return ret_hu_conv;
71         }
72
73 }