1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A reply_channel_range message is a reply to a query_channel_range
13 * message. Multiple reply_channel_range messages can be sent in reply
14 * to a single query_channel_range message. The query recipient makes a
15 * best effort to respond based on their local network view which may
16 * not be a perfect view of the network. The short_channel_ids in the
17 * reply are encoded. We only support encoding_type=0 uncompressed
18 * serialization and do not support encoding_type=1 zlib serialization.
20 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
21 public class ReplyChannelRange extends CommonBase {
22 ReplyChannelRange(Object _dummy, long ptr) { super(ptr); }
23 @Override @SuppressWarnings("deprecation")
24 protected void finalize() throws Throwable {
26 if (ptr != 0) { bindings.ReplyChannelRange_free(ptr); }
30 * The genesis hash of the blockchain being queried
32 public byte[] get_chain_hash() {
33 byte[] ret = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
34 Reference.reachabilityFence(this);
39 * The genesis hash of the blockchain being queried
41 public void set_chain_hash(byte[] val) {
42 bindings.ReplyChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
43 Reference.reachabilityFence(this);
44 Reference.reachabilityFence(val);
48 * The height of the first block in the range of the reply
50 public int get_first_blocknum() {
51 int ret = bindings.ReplyChannelRange_get_first_blocknum(this.ptr);
52 Reference.reachabilityFence(this);
57 * The height of the first block in the range of the reply
59 public void set_first_blocknum(int val) {
60 bindings.ReplyChannelRange_set_first_blocknum(this.ptr, val);
61 Reference.reachabilityFence(this);
62 Reference.reachabilityFence(val);
66 * The number of blocks included in the range of the reply
68 public int get_number_of_blocks() {
69 int ret = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr);
70 Reference.reachabilityFence(this);
75 * The number of blocks included in the range of the reply
77 public void set_number_of_blocks(int val) {
78 bindings.ReplyChannelRange_set_number_of_blocks(this.ptr, val);
79 Reference.reachabilityFence(this);
80 Reference.reachabilityFence(val);
84 * True when this is the final reply for a query
86 public boolean get_sync_complete() {
87 boolean ret = bindings.ReplyChannelRange_get_sync_complete(this.ptr);
88 Reference.reachabilityFence(this);
93 * True when this is the final reply for a query
95 public void set_sync_complete(boolean val) {
96 bindings.ReplyChannelRange_set_sync_complete(this.ptr, val);
97 Reference.reachabilityFence(this);
98 Reference.reachabilityFence(val);
102 * The short_channel_ids in the channel range
104 public void set_short_channel_ids(long[] val) {
105 bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, val);
106 Reference.reachabilityFence(this);
107 Reference.reachabilityFence(val);
111 * Constructs a new ReplyChannelRange given each field
113 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) {
114 long ret = bindings.ReplyChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg);
115 Reference.reachabilityFence(chain_hash_arg);
116 Reference.reachabilityFence(first_blocknum_arg);
117 Reference.reachabilityFence(number_of_blocks_arg);
118 Reference.reachabilityFence(sync_complete_arg);
119 Reference.reachabilityFence(short_channel_ids_arg);
120 if (ret >= 0 && ret <= 4096) { return null; }
121 ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ReplyChannelRange(null, ret); }
122 ret_hu_conv.ptrs_to.add(ret_hu_conv);
127 long ret = bindings.ReplyChannelRange_clone_ptr(this.ptr);
128 Reference.reachabilityFence(this);
133 * Creates a copy of the ReplyChannelRange
135 public ReplyChannelRange clone() {
136 long ret = bindings.ReplyChannelRange_clone(this.ptr);
137 Reference.reachabilityFence(this);
138 if (ret >= 0 && ret <= 4096) { return null; }
139 ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ReplyChannelRange(null, ret); }
140 ret_hu_conv.ptrs_to.add(this);
145 * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
147 public static Result_ReplyChannelRangeDecodeErrorZ read(byte[] ser) {
148 long ret = bindings.ReplyChannelRange_read(ser);
149 Reference.reachabilityFence(ser);
150 if (ret >= 0 && ret <= 4096) { return null; }
151 Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret);
156 * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
158 public byte[] write() {
159 byte[] ret = bindings.ReplyChannelRange_write(this.ptr);
160 Reference.reachabilityFence(this);