Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / ReplyChannelRange.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 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.
19  */
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 {
25                 super.finalize();
26                 if (ptr != 0) { bindings.ReplyChannelRange_free(ptr); }
27         }
28
29         /**
30          * The genesis hash of the blockchain being queried
31          */
32         public byte[] get_chain_hash() {
33                 byte[] ret = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
34                 Reference.reachabilityFence(this);
35                 return ret;
36         }
37
38         /**
39          * The genesis hash of the blockchain being queried
40          */
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);
45         }
46
47         /**
48          * The height of the first block in the range of the reply
49          */
50         public int get_first_blocknum() {
51                 int ret = bindings.ReplyChannelRange_get_first_blocknum(this.ptr);
52                 Reference.reachabilityFence(this);
53                 return ret;
54         }
55
56         /**
57          * The height of the first block in the range of the reply
58          */
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);
63         }
64
65         /**
66          * The number of blocks included in the range of the reply
67          */
68         public int get_number_of_blocks() {
69                 int ret = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         /**
75          * The number of blocks included in the range of the reply
76          */
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);
81         }
82
83         /**
84          * True when this is the final reply for a query
85          */
86         public boolean get_sync_complete() {
87                 boolean ret = bindings.ReplyChannelRange_get_sync_complete(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         /**
93          * True when this is the final reply for a query
94          */
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);
99         }
100
101         /**
102          * The short_channel_ids in the channel range
103          */
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);
108         }
109
110         /**
111          * Constructs a new ReplyChannelRange given each field
112          */
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);
123                 return ret_hu_conv;
124         }
125
126         long clone_ptr() {
127                 long ret = bindings.ReplyChannelRange_clone_ptr(this.ptr);
128                 Reference.reachabilityFence(this);
129                 return ret;
130         }
131
132         /**
133          * Creates a copy of the ReplyChannelRange
134          */
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);
141                 return ret_hu_conv;
142         }
143
144         /**
145          * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
146          */
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);
152                 return ret_hu_conv;
153         }
154
155         /**
156          * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
157          */
158         public byte[] write() {
159                 byte[] ret = bindings.ReplyChannelRange_write(this.ptr);
160                 Reference.reachabilityFence(this);
161                 return ret;
162         }
163
164 }