1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * A reply_channel_range message is a reply to a query_channel_range
12 * message. Multiple reply_channel_range messages can be sent in reply
13 * to a single query_channel_range message. The query recipient makes a
14 * best effort to respond based on their local network view which may
15 * not be a perfect view of the network. The short_channel_ids in the
16 * reply are encoded. We only support encoding_type=0 uncompressed
17 * serialization and do not support encoding_type=1 zlib serialization.
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class ReplyChannelRange extends CommonBase {
21 ReplyChannelRange(Object _dummy, long ptr) { super(ptr); }
22 @Override @SuppressWarnings("deprecation")
23 protected void finalize() throws Throwable {
25 if (ptr != 0) { bindings.ReplyChannelRange_free(ptr); }
29 * The genesis hash of the blockchain being queried
31 public byte[] get_chain_hash() {
32 byte[] ret = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
37 * The genesis hash of the blockchain being queried
39 public void set_chain_hash(byte[] val) {
40 bindings.ReplyChannelRange_set_chain_hash(this.ptr, val);
44 * The height of the first block in the range of the reply
46 public int get_first_blocknum() {
47 int ret = bindings.ReplyChannelRange_get_first_blocknum(this.ptr);
52 * The height of the first block in the range of the reply
54 public void set_first_blocknum(int val) {
55 bindings.ReplyChannelRange_set_first_blocknum(this.ptr, val);
59 * The number of blocks included in the range of the reply
61 public int get_number_of_blocks() {
62 int ret = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr);
67 * The number of blocks included in the range of the reply
69 public void set_number_of_blocks(int val) {
70 bindings.ReplyChannelRange_set_number_of_blocks(this.ptr, val);
74 * True when this is the final reply for a query
76 public boolean get_sync_complete() {
77 boolean ret = bindings.ReplyChannelRange_get_sync_complete(this.ptr);
82 * True when this is the final reply for a query
84 public void set_sync_complete(boolean val) {
85 bindings.ReplyChannelRange_set_sync_complete(this.ptr, val);
89 * The short_channel_ids in the channel range
91 public void set_short_channel_ids(long[] val) {
92 bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, val);
96 * Constructs a new ReplyChannelRange given each field
98 public static ReplyChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg, boolean sync_complete_arg, long[] short_channel_ids_arg) {
99 long ret = bindings.ReplyChannelRange_new(chain_hash_arg, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg);
100 if (ret < 1024) { return null; }
101 ReplyChannelRange ret_hu_conv = new ReplyChannelRange(null, ret);
102 ret_hu_conv.ptrs_to.add(ret_hu_conv);
107 * Creates a copy of the ReplyChannelRange
109 public ReplyChannelRange clone() {
110 long ret = bindings.ReplyChannelRange_clone(this.ptr);
111 if (ret < 1024) { return null; }
112 ReplyChannelRange ret_hu_conv = new ReplyChannelRange(null, ret);
113 ret_hu_conv.ptrs_to.add(this);
118 * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
120 public static Result_ReplyChannelRangeDecodeErrorZ read(byte[] ser) {
121 long ret = bindings.ReplyChannelRange_read(ser);
122 if (ret < 1024) { return null; }
123 Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret);
128 * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
130 public byte[] write() {
131 byte[] ret = bindings.ReplyChannelRange_write(this.ptr);