6 namespace org { namespace ldk { namespace structs {
10 * A [`gossip_timestamp_filter`] message is used by a node to request
11 * gossip relay for messages in the requested time range when the
12 * `gossip_queries` feature has been negotiated.
14 * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
16 public class GossipTimestampFilter : CommonBase {
17 internal GossipTimestampFilter(object _dummy, long ptr) : base(ptr) { }
18 ~GossipTimestampFilter() {
19 if (ptr != 0) { bindings.GossipTimestampFilter_free(ptr); }
23 * The genesis hash of the blockchain for channel and node information
25 public byte[] get_chain_hash() {
26 long ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr);
28 if (ret >= 0 && ret <= 4096) { return null; }
29 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
34 * The genesis hash of the blockchain for channel and node information
36 public void set_chain_hash(byte[] val) {
37 bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
43 * The starting unix timestamp
45 public int get_first_timestamp() {
46 int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr);
52 * The starting unix timestamp
54 public void set_first_timestamp(int val) {
55 bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val);
61 * The range of information in seconds
63 public int get_timestamp_range() {
64 int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr);
70 * The range of information in seconds
72 public void set_timestamp_range(int val) {
73 bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val);
79 * Constructs a new GossipTimestampFilter given each field
81 public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
82 long ret = bindings.GossipTimestampFilter_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), first_timestamp_arg, timestamp_range_arg);
83 GC.KeepAlive(chain_hash_arg);
84 GC.KeepAlive(first_timestamp_arg);
85 GC.KeepAlive(timestamp_range_arg);
86 if (ret >= 0 && ret <= 4096) { return null; }
87 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
88 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
92 internal long clone_ptr() {
93 long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr);
99 * Creates a copy of the GossipTimestampFilter
101 public GossipTimestampFilter clone() {
102 long ret = bindings.GossipTimestampFilter_clone(this.ptr);
104 if (ret >= 0 && ret <= 4096) { return null; }
105 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
106 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
111 * Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter.
114 long ret = bindings.GossipTimestampFilter_hash(this.ptr);
119 public override int GetHashCode() {
120 return (int)this.hash();
123 * Checks if two GossipTimestampFilters contain equal inner contents.
124 * This ignores pointers and is_owned flags and looks at the values in fields.
125 * Two objects with NULL inner values will be considered "equal" here.
127 public bool eq(org.ldk.structs.GossipTimestampFilter b) {
128 bool ret = bindings.GossipTimestampFilter_eq(this.ptr, b == null ? 0 : b.ptr);
131 if (this != null) { this.ptrs_to.AddLast(b); };
135 public override bool Equals(object o) {
136 if (!(o is GossipTimestampFilter)) return false;
137 return this.eq((GossipTimestampFilter)o);
140 * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
142 public byte[] write() {
143 long ret = bindings.GossipTimestampFilter_write(this.ptr);
145 if (ret >= 0 && ret <= 4096) { return null; }
146 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
151 * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
153 public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) {
154 long ret = bindings.GossipTimestampFilter_read(InternalUtils.encodeUint8Array(ser));
156 if (ret >= 0 && ret <= 4096) { return null; }
157 Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);