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 query_short_channel_ids message is used to query a peer for
12 * routing gossip messages related to one or more short_channel_ids.
13 * The query recipient will reply with the latest, if available,
14 * channel_announcement, channel_update and node_announcement messages
15 * it maintains for the requested short_channel_ids followed by a
16 * reply_short_channel_ids_end message. The short_channel_ids sent in
17 * this query 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 QueryShortChannelIds extends CommonBase {
22 QueryShortChannelIds(Object _dummy, long ptr) { super(ptr); }
23 @Override @SuppressWarnings("deprecation")
24 protected void finalize() throws Throwable {
26 if (ptr != 0) { bindings.QueryShortChannelIds_free(ptr); }
30 * The genesis hash of the blockchain being queried
32 public byte[] get_chain_hash() {
33 byte[] ret = bindings.QueryShortChannelIds_get_chain_hash(this.ptr);
38 * The genesis hash of the blockchain being queried
40 public void set_chain_hash(byte[] val) {
41 bindings.QueryShortChannelIds_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
45 * The short_channel_ids that are being queried
47 public void set_short_channel_ids(long[] val) {
48 bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, val);
52 * Constructs a new QueryShortChannelIds given each field
54 public static QueryShortChannelIds of(byte[] chain_hash_arg, long[] short_channel_ids_arg) {
55 long ret = bindings.QueryShortChannelIds_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_ids_arg);
56 if (ret >= 0 && ret <= 4096) { return null; }
57 QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryShortChannelIds(null, ret); }
58 ret_hu_conv.ptrs_to.add(ret_hu_conv);
63 long ret = bindings.QueryShortChannelIds_clone_ptr(this.ptr);
68 * Creates a copy of the QueryShortChannelIds
70 public QueryShortChannelIds clone() {
71 long ret = bindings.QueryShortChannelIds_clone(this.ptr);
72 if (ret >= 0 && ret <= 4096) { return null; }
73 QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryShortChannelIds(null, ret); }
74 ret_hu_conv.ptrs_to.add(this);
79 * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
81 public static Result_QueryShortChannelIdsDecodeErrorZ read(byte[] ser) {
82 long ret = bindings.QueryShortChannelIds_read(ser);
83 if (ret >= 0 && ret <= 4096) { return null; }
84 Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret);
89 * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
91 public byte[] write() {
92 byte[] ret = bindings.QueryShortChannelIds_write(this.ptr);