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 * Returns a copy of the field.
53 public long[] get_short_channel_ids() {
54 long[] ret = bindings.QueryShortChannelIds_get_short_channel_ids(this.ptr);
55 Reference.reachabilityFence(this);
60 * The short_channel_ids that are being queried
62 public void set_short_channel_ids(long[] val) {
63 bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, val);
64 Reference.reachabilityFence(this);
65 Reference.reachabilityFence(val);
69 * Constructs a new QueryShortChannelIds given each field
71 public static QueryShortChannelIds of(byte[] chain_hash_arg, long[] short_channel_ids_arg) {
72 long ret = bindings.QueryShortChannelIds_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_ids_arg);
73 Reference.reachabilityFence(chain_hash_arg);
74 Reference.reachabilityFence(short_channel_ids_arg);
75 if (ret >= 0 && ret <= 4096) { return null; }
76 org.ldk.structs.QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, ret); }
77 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
82 long ret = bindings.QueryShortChannelIds_clone_ptr(this.ptr);
83 Reference.reachabilityFence(this);
88 * Creates a copy of the QueryShortChannelIds
90 public QueryShortChannelIds clone() {
91 long ret = bindings.QueryShortChannelIds_clone(this.ptr);
92 Reference.reachabilityFence(this);
93 if (ret >= 0 && ret <= 4096) { return null; }
94 org.ldk.structs.QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, ret); }
95 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
100 * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
102 public static Result_QueryShortChannelIdsDecodeErrorZ read(byte[] ser) {
103 long ret = bindings.QueryShortChannelIds_read(ser);
104 Reference.reachabilityFence(ser);
105 if (ret >= 0 && ret <= 4096) { return null; }
106 Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret);
111 * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
113 public byte[] write() {
114 byte[] ret = bindings.QueryShortChannelIds_write(this.ptr);
115 Reference.reachabilityFence(this);