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 [`reply_short_channel_ids_end`] message is sent as a reply to a
13 * message. The query recipient makes a best
14 * effort to respond based on their local network view which may not be
15 * a perfect view of the network.
17 * [`reply_short_channel_ids_end`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class ReplyShortChannelIdsEnd extends CommonBase {
21 ReplyShortChannelIdsEnd(Object _dummy, long ptr) { super(ptr); }
22 @Override @SuppressWarnings("deprecation")
23 protected void finalize() throws Throwable {
25 if (ptr != 0) { bindings.ReplyShortChannelIdsEnd_free(ptr); }
29 * The genesis hash of the blockchain that was queried
31 public byte[] get_chain_hash() {
32 byte[] ret = bindings.ReplyShortChannelIdsEnd_get_chain_hash(this.ptr);
33 Reference.reachabilityFence(this);
38 * The genesis hash of the blockchain that was queried
40 public void set_chain_hash(byte[] val) {
41 bindings.ReplyShortChannelIdsEnd_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
42 Reference.reachabilityFence(this);
43 Reference.reachabilityFence(val);
47 * Indicates if the query recipient maintains up-to-date channel
48 * information for the `chain_hash`
50 public boolean get_full_information() {
51 boolean ret = bindings.ReplyShortChannelIdsEnd_get_full_information(this.ptr);
52 Reference.reachabilityFence(this);
57 * Indicates if the query recipient maintains up-to-date channel
58 * information for the `chain_hash`
60 public void set_full_information(boolean val) {
61 bindings.ReplyShortChannelIdsEnd_set_full_information(this.ptr, val);
62 Reference.reachabilityFence(this);
63 Reference.reachabilityFence(val);
67 * Constructs a new ReplyShortChannelIdsEnd given each field
69 public static ReplyShortChannelIdsEnd of(byte[] chain_hash_arg, boolean full_information_arg) {
70 long ret = bindings.ReplyShortChannelIdsEnd_new(InternalUtils.check_arr_len(chain_hash_arg, 32), full_information_arg);
71 Reference.reachabilityFence(chain_hash_arg);
72 Reference.reachabilityFence(full_information_arg);
73 if (ret >= 0 && ret <= 4096) { return null; }
74 org.ldk.structs.ReplyShortChannelIdsEnd ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyShortChannelIdsEnd(null, ret); }
75 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
80 long ret = bindings.ReplyShortChannelIdsEnd_clone_ptr(this.ptr);
81 Reference.reachabilityFence(this);
86 * Creates a copy of the ReplyShortChannelIdsEnd
88 public ReplyShortChannelIdsEnd clone() {
89 long ret = bindings.ReplyShortChannelIdsEnd_clone(this.ptr);
90 Reference.reachabilityFence(this);
91 if (ret >= 0 && ret <= 4096) { return null; }
92 org.ldk.structs.ReplyShortChannelIdsEnd ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyShortChannelIdsEnd(null, ret); }
93 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
98 * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
99 * This ignores pointers and is_owned flags and looks at the values in fields.
100 * Two objects with NULL inner values will be considered "equal" here.
102 public boolean eq(org.ldk.structs.ReplyShortChannelIdsEnd b) {
103 boolean ret = bindings.ReplyShortChannelIdsEnd_eq(this.ptr, b == null ? 0 : b.ptr);
104 Reference.reachabilityFence(this);
105 Reference.reachabilityFence(b);
106 if (this != null) { this.ptrs_to.add(b); };
110 @Override public boolean equals(Object o) {
111 if (!(o instanceof ReplyShortChannelIdsEnd)) return false;
112 return this.eq((ReplyShortChannelIdsEnd)o);
115 * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
117 public byte[] write() {
118 byte[] ret = bindings.ReplyShortChannelIdsEnd_write(this.ptr);
119 Reference.reachabilityFence(this);
124 * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
126 public static Result_ReplyShortChannelIdsEndDecodeErrorZ read(byte[] ser) {
127 long ret = bindings.ReplyShortChannelIdsEnd_read(ser);
128 Reference.reachabilityFence(ser);
129 if (ret >= 0 && ret <= 4096) { return null; }
130 Result_ReplyShortChannelIdsEndDecodeErrorZ ret_hu_conv = Result_ReplyShortChannelIdsEndDecodeErrorZ.constr_from_ptr(ret);