Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / QueryShortChannelIds.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
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.
20  */
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 {
26                 super.finalize();
27                 if (ptr != 0) { bindings.QueryShortChannelIds_free(ptr); }
28         }
29
30         /**
31          * The genesis hash of the blockchain being queried
32          */
33         public byte[] get_chain_hash() {
34                 byte[] ret = bindings.QueryShortChannelIds_get_chain_hash(this.ptr);
35                 Reference.reachabilityFence(this);
36                 return ret;
37         }
38
39         /**
40          * The genesis hash of the blockchain being queried
41          */
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);
46         }
47
48         /**
49          * The short_channel_ids that are being queried
50          */
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);
55         }
56
57         /**
58          * Constructs a new QueryShortChannelIds given each field
59          */
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);
67                 return ret_hu_conv;
68         }
69
70         long clone_ptr() {
71                 long ret = bindings.QueryShortChannelIds_clone_ptr(this.ptr);
72                 Reference.reachabilityFence(this);
73                 return ret;
74         }
75
76         /**
77          * Creates a copy of the QueryShortChannelIds
78          */
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);
85                 return ret_hu_conv;
86         }
87
88         /**
89          * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
90          */
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);
96                 return ret_hu_conv;
97         }
98
99         /**
100          * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
101          */
102         public byte[] write() {
103                 byte[] ret = bindings.QueryShortChannelIds_write(this.ptr);
104                 Reference.reachabilityFence(this);
105                 return ret;
106         }
107
108 }