X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FGossipTimestampFilter.java;h=0e35356b2e4c428528157e7163678da7fcc2776d;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=ca69712253f169629f31fe07c171c45bc9f55ccd;hpb=ba1af51214a8ea2de62b84cd23b6145173c71752;p=ldk-java diff --git a/src/main/java/org/ldk/structs/GossipTimestampFilter.java b/src/main/java/org/ldk/structs/GossipTimestampFilter.java index ca697122..0e35356b 100644 --- a/src/main/java/org/ldk/structs/GossipTimestampFilter.java +++ b/src/main/java/org/ldk/structs/GossipTimestampFilter.java @@ -33,7 +33,7 @@ public class GossipTimestampFilter extends CommonBase { * The genesis hash of the blockchain for channel and node information */ public void set_chain_hash(byte[] val) { - bindings.GossipTimestampFilter_set_chain_hash(this.ptr, val); + bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); } /** @@ -70,40 +70,45 @@ public class GossipTimestampFilter extends CommonBase { * Constructs a new GossipTimestampFilter given each field */ public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) { - long ret = bindings.GossipTimestampFilter_new(chain_hash_arg, first_timestamp_arg, timestamp_range_arg); - if (ret < 1024) { return null; } - GossipTimestampFilter ret_hu_conv = new GossipTimestampFilter(null, ret); + long ret = bindings.GossipTimestampFilter_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_timestamp_arg, timestamp_range_arg); + if (ret >= 0 && ret <= 4096) { return null; } + GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } + long clone_ptr() { + long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr); + return ret; + } + /** * Creates a copy of the GossipTimestampFilter */ public GossipTimestampFilter clone() { long ret = bindings.GossipTimestampFilter_clone(this.ptr); - if (ret < 1024) { return null; } - GossipTimestampFilter ret_hu_conv = new GossipTimestampFilter(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read + */ + public byte[] write() { + byte[] ret = bindings.GossipTimestampFilter_write(this.ptr); + return ret; + } + /** * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write */ public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) { long ret = bindings.GossipTimestampFilter_read(ser); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } - /** - * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read - */ - public byte[] write() { - byte[] ret = bindings.GossipTimestampFilter_write(this.ptr); - return ret; - } - }