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 gossip_timestamp_filter message is used by a node to request
13 * gossip relay for messages in the requested time range when the
14 * gossip_queries feature has been negotiated.
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class GossipTimestampFilter extends CommonBase {
18 GossipTimestampFilter(Object _dummy, long ptr) { super(ptr); }
19 @Override @SuppressWarnings("deprecation")
20 protected void finalize() throws Throwable {
22 if (ptr != 0) { bindings.GossipTimestampFilter_free(ptr); }
26 * The genesis hash of the blockchain for channel and node information
28 public byte[] get_chain_hash() {
29 byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr);
30 Reference.reachabilityFence(this);
35 * The genesis hash of the blockchain for channel and node information
37 public void set_chain_hash(byte[] val) {
38 bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
39 Reference.reachabilityFence(this);
40 Reference.reachabilityFence(val);
44 * The starting unix timestamp
46 public int get_first_timestamp() {
47 int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr);
48 Reference.reachabilityFence(this);
53 * The starting unix timestamp
55 public void set_first_timestamp(int val) {
56 bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val);
57 Reference.reachabilityFence(this);
58 Reference.reachabilityFence(val);
62 * The range of information in seconds
64 public int get_timestamp_range() {
65 int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr);
66 Reference.reachabilityFence(this);
71 * The range of information in seconds
73 public void set_timestamp_range(int val) {
74 bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val);
75 Reference.reachabilityFence(this);
76 Reference.reachabilityFence(val);
80 * Constructs a new GossipTimestampFilter given each field
82 public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
83 long ret = bindings.GossipTimestampFilter_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_timestamp_arg, timestamp_range_arg);
84 Reference.reachabilityFence(chain_hash_arg);
85 Reference.reachabilityFence(first_timestamp_arg);
86 Reference.reachabilityFence(timestamp_range_arg);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
89 ret_hu_conv.ptrs_to.add(ret_hu_conv);
94 long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr);
95 Reference.reachabilityFence(this);
100 * Creates a copy of the GossipTimestampFilter
102 public GossipTimestampFilter clone() {
103 long ret = bindings.GossipTimestampFilter_clone(this.ptr);
104 Reference.reachabilityFence(this);
105 if (ret >= 0 && ret <= 4096) { return null; }
106 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
107 ret_hu_conv.ptrs_to.add(this);
112 * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
114 public byte[] write() {
115 byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
116 Reference.reachabilityFence(this);
121 * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
123 public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) {
124 long ret = bindings.GossipTimestampFilter_read(ser);
125 Reference.reachabilityFence(ser);
126 if (ret >= 0 && ret <= 4096) { return null; }
127 Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);