1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * A query_channel_range message is used to query a peer for channel
11 * UTXOs in a range of blocks. The recipient of a query makes a best
12 * effort to reply to the query using one or more reply_channel_range
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class QueryChannelRange extends CommonBase {
17 QueryChannelRange(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.QueryChannelRange_free(ptr); }
25 * The genesis hash of the blockchain being queried
27 public byte[] get_chain_hash() {
28 byte[] ret = bindings.QueryChannelRange_get_chain_hash(this.ptr);
33 * The genesis hash of the blockchain being queried
35 public void set_chain_hash(byte[] val) {
36 bindings.QueryChannelRange_set_chain_hash(this.ptr, val);
40 * The height of the first block for the channel UTXOs being queried
42 public int get_first_blocknum() {
43 int ret = bindings.QueryChannelRange_get_first_blocknum(this.ptr);
48 * The height of the first block for the channel UTXOs being queried
50 public void set_first_blocknum(int val) {
51 bindings.QueryChannelRange_set_first_blocknum(this.ptr, val);
55 * The number of blocks to include in the query results
57 public int get_number_of_blocks() {
58 int ret = bindings.QueryChannelRange_get_number_of_blocks(this.ptr);
63 * The number of blocks to include in the query results
65 public void set_number_of_blocks(int val) {
66 bindings.QueryChannelRange_set_number_of_blocks(this.ptr, val);
70 * Constructs a new QueryChannelRange given each field
72 public static QueryChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg) {
73 long ret = bindings.QueryChannelRange_new(chain_hash_arg, first_blocknum_arg, number_of_blocks_arg);
74 QueryChannelRange ret_hu_conv = new QueryChannelRange(null, ret);
75 ret_hu_conv.ptrs_to.add(ret_hu_conv);
80 * Creates a copy of the QueryChannelRange
82 public QueryChannelRange clone() {
83 long ret = bindings.QueryChannelRange_clone(this.ptr);
84 QueryChannelRange ret_hu_conv = new QueryChannelRange(null, ret);
85 ret_hu_conv.ptrs_to.add(this);
90 * \n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t
92 public int end_blocknum() {
93 int ret = bindings.QueryChannelRange_end_blocknum(this.ptr);
98 * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
100 public static Result_QueryChannelRangeDecodeErrorZ read(byte[] ser) {
101 long ret = bindings.QueryChannelRange_read(ser);
102 Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret);
107 * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
109 public byte[] write() {
110 byte[] ret = bindings.QueryChannelRange_write(this.ptr);