6 namespace org { namespace ldk { namespace structs {
10 * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`]
13 * Multiple `reply_channel_range` messages can be sent in reply
14 * to a single [`QueryChannelRange`] 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_id`s in the
17 * reply are encoded. We only support `encoding_type=0` uncompressed
18 * serialization and do not support `encoding_type=1` zlib serialization.
20 * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
22 public class ReplyChannelRange : CommonBase {
23 internal ReplyChannelRange(object _dummy, long ptr) : base(ptr) { }
24 ~ReplyChannelRange() {
25 if (ptr != 0) { bindings.ReplyChannelRange_free(ptr); }
29 * The genesis hash of the blockchain being queried
31 public byte[] get_chain_hash() {
32 long ret = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
34 if (ret >= 0 && ret <= 4096) { return null; }
35 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
40 * The genesis hash of the blockchain being queried
42 public void set_chain_hash(byte[] val) {
43 bindings.ReplyChannelRange_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
49 * The height of the first block in the range of the reply
51 public int get_first_blocknum() {
52 int ret = bindings.ReplyChannelRange_get_first_blocknum(this.ptr);
58 * The height of the first block in the range of the reply
60 public void set_first_blocknum(int val) {
61 bindings.ReplyChannelRange_set_first_blocknum(this.ptr, val);
67 * The number of blocks included in the range of the reply
69 public int get_number_of_blocks() {
70 int ret = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr);
76 * The number of blocks included in the range of the reply
78 public void set_number_of_blocks(int val) {
79 bindings.ReplyChannelRange_set_number_of_blocks(this.ptr, val);
85 * True when this is the final reply for a query
87 public bool get_sync_complete() {
88 bool ret = bindings.ReplyChannelRange_get_sync_complete(this.ptr);
94 * True when this is the final reply for a query
96 public void set_sync_complete(bool val) {
97 bindings.ReplyChannelRange_set_sync_complete(this.ptr, val);
103 * The `short_channel_id`s in the channel range
105 * Returns a copy of the field.
107 public long[] get_short_channel_ids() {
108 long ret = bindings.ReplyChannelRange_get_short_channel_ids(this.ptr);
110 if (ret >= 0 && ret <= 4096) { return null; }
111 long[] ret_conv = InternalUtils.decodeUint64Array(ret);
116 * The `short_channel_id`s in the channel range
118 public void set_short_channel_ids(long[] val) {
119 bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, InternalUtils.encodeUint64Array(val));
125 * Constructs a new ReplyChannelRange given each field
127 public static ReplyChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg, bool sync_complete_arg, long[] short_channel_ids_arg) {
128 long ret = bindings.ReplyChannelRange_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, InternalUtils.encodeUint64Array(short_channel_ids_arg));
129 GC.KeepAlive(chain_hash_arg);
130 GC.KeepAlive(first_blocknum_arg);
131 GC.KeepAlive(number_of_blocks_arg);
132 GC.KeepAlive(sync_complete_arg);
133 GC.KeepAlive(short_channel_ids_arg);
134 if (ret >= 0 && ret <= 4096) { return null; }
135 org.ldk.structs.ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyChannelRange(null, ret); }
136 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
140 internal long clone_ptr() {
141 long ret = bindings.ReplyChannelRange_clone_ptr(this.ptr);
147 * Creates a copy of the ReplyChannelRange
149 public ReplyChannelRange clone() {
150 long ret = bindings.ReplyChannelRange_clone(this.ptr);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 org.ldk.structs.ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyChannelRange(null, ret); }
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
159 * Generates a non-cryptographic 64-bit hash of the ReplyChannelRange.
162 long ret = bindings.ReplyChannelRange_hash(this.ptr);
167 public override int GetHashCode() {
168 return (int)this.hash();
171 * Checks if two ReplyChannelRanges contain equal inner contents.
172 * This ignores pointers and is_owned flags and looks at the values in fields.
173 * Two objects with NULL inner values will be considered "equal" here.
175 public bool eq(org.ldk.structs.ReplyChannelRange b) {
176 bool ret = bindings.ReplyChannelRange_eq(this.ptr, b == null ? 0 : b.ptr);
179 if (this != null) { this.ptrs_to.AddLast(b); };
183 public override bool Equals(object o) {
184 if (!(o is ReplyChannelRange)) return false;
185 return this.eq((ReplyChannelRange)o);
188 * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
190 public static Result_ReplyChannelRangeDecodeErrorZ read(byte[] ser) {
191 long ret = bindings.ReplyChannelRange_read(InternalUtils.encodeUint8Array(ser));
193 if (ret >= 0 && ret <= 4096) { return null; }
194 Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret);
199 * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
201 public byte[] write() {
202 long ret = bindings.ReplyChannelRange_write(this.ptr);
204 if (ret >= 0 && ret <= 4096) { return null; }
205 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);