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 query_short_channel_ids message is used to query a peer for
13 * routing gossip messages related to one or more short_channel_ids.
14 * The query recipient will reply with the latest, if available,
15 * channel_announcement, channel_update and node_announcement messages
16 * it maintains for the requested short_channel_ids followed by a
17 * reply_short_channel_ids_end message. The short_channel_ids sent in
18 * this query are encoded. We only support encoding_type=0 uncompressed
19 * serialization and do not support encoding_type=1 zlib serialization.
21 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
22 public class QueryShortChannelIds extends CommonBase {
23 QueryShortChannelIds(Object _dummy, long ptr) { super(ptr); }
24 @Override @SuppressWarnings("deprecation")
25 protected void finalize() throws Throwable {
27 if (ptr != 0) { bindings.QueryShortChannelIds_free(ptr); }
31 * The genesis hash of the blockchain being queried
33 public byte[] get_chain_hash() {
34 byte[] ret = bindings.QueryShortChannelIds_get_chain_hash(this.ptr);
35 Reference.reachabilityFence(this);
40 * The genesis hash of the blockchain being queried
42 public void set_chain_hash(byte[] val) {
43 bindings.QueryShortChannelIds_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
44 Reference.reachabilityFence(this);
45 Reference.reachabilityFence(val);
49 * The short_channel_ids that are being queried
51 public void set_short_channel_ids(long[] val) {
52 bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, val);
53 Reference.reachabilityFence(this);
54 Reference.reachabilityFence(val);
58 * Constructs a new QueryShortChannelIds given each field
60 public static QueryShortChannelIds of(byte[] chain_hash_arg, long[] short_channel_ids_arg) {
61 long ret = bindings.QueryShortChannelIds_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_ids_arg);
62 Reference.reachabilityFence(chain_hash_arg);
63 Reference.reachabilityFence(short_channel_ids_arg);
64 if (ret >= 0 && ret <= 4096) { return null; }
65 QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryShortChannelIds(null, ret); }
66 ret_hu_conv.ptrs_to.add(ret_hu_conv);
71 long ret = bindings.QueryShortChannelIds_clone_ptr(this.ptr);
72 Reference.reachabilityFence(this);
77 * Creates a copy of the QueryShortChannelIds
79 public QueryShortChannelIds clone() {
80 long ret = bindings.QueryShortChannelIds_clone(this.ptr);
81 Reference.reachabilityFence(this);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryShortChannelIds(null, ret); }
84 ret_hu_conv.ptrs_to.add(this);
89 * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
91 public static Result_QueryShortChannelIdsDecodeErrorZ read(byte[] ser) {
92 long ret = bindings.QueryShortChannelIds_read(ser);
93 Reference.reachabilityFence(ser);
94 if (ret >= 0 && ret <= 4096) { return null; }
95 Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret);
100 * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
102 public byte[] write() {
103 byte[] ret = bindings.QueryShortChannelIds_write(this.ptr);
104 Reference.reachabilityFence(this);