X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FQueryChannelRange.java;h=0392ad3bd1b6f7c1b17195cc6b127ba63df81bd7;hb=b6cc0960eaee5a5bbc7fde79a56152d6dcd649d8;hp=f12c69aab830c946ad20e9e438c26efb76af8175;hpb=aa0e2aade37133339f4113a0cd7465b111f0a0d0;p=ldk-java diff --git a/src/main/java/org/ldk/structs/QueryChannelRange.java b/src/main/java/org/ldk/structs/QueryChannelRange.java index f12c69aa..0392ad3b 100644 --- a/src/main/java/org/ldk/structs/QueryChannelRange.java +++ b/src/main/java/org/ldk/structs/QueryChannelRange.java @@ -5,6 +5,13 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * A query_channel_range message is used to query a peer for channel + * UTXOs in a range of blocks. The recipient of a query makes a best + * effort to reply to the query using one or more reply_channel_range + * messages. + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class QueryChannelRange extends CommonBase { QueryChannelRange(Object _dummy, long ptr) { super(ptr); } @@ -14,55 +21,93 @@ public class QueryChannelRange extends CommonBase { if (ptr != 0) { bindings.QueryChannelRange_free(ptr); } } - public static QueryChannelRange constructor_clone(QueryChannelRange orig) { - long ret = bindings.QueryChannelRange_clone(orig == null ? 0 : orig.ptr & ~1); - QueryChannelRange ret_hu_conv = new QueryChannelRange(null, ret); - ret_hu_conv.ptrs_to.add(orig); - return ret_hu_conv; - } - + /** + * The genesis hash of the blockchain being queried + */ public byte[] get_chain_hash() { byte[] ret = bindings.QueryChannelRange_get_chain_hash(this.ptr); return ret; } + /** + * The genesis hash of the blockchain being queried + */ public void set_chain_hash(byte[] val) { bindings.QueryChannelRange_set_chain_hash(this.ptr, val); } + /** + * The height of the first block for the channel UTXOs being queried + */ public int get_first_blocknum() { int ret = bindings.QueryChannelRange_get_first_blocknum(this.ptr); return ret; } + /** + * The height of the first block for the channel UTXOs being queried + */ public void set_first_blocknum(int val) { bindings.QueryChannelRange_set_first_blocknum(this.ptr, val); } + /** + * The number of blocks to include in the query results + */ public int get_number_of_blocks() { int ret = bindings.QueryChannelRange_get_number_of_blocks(this.ptr); return ret; } + /** + * The number of blocks to include in the query results + */ public void set_number_of_blocks(int val) { bindings.QueryChannelRange_set_number_of_blocks(this.ptr, val); } - public static QueryChannelRange constructor_new(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg) { + /** + * Constructs a new QueryChannelRange given each field + */ + public static QueryChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg) { long ret = bindings.QueryChannelRange_new(chain_hash_arg, first_blocknum_arg, number_of_blocks_arg); QueryChannelRange ret_hu_conv = new QueryChannelRange(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } - public static QueryChannelRange constructor_read(byte[] ser) { - long ret = bindings.QueryChannelRange_read(ser); + /** + * Creates a copy of the QueryChannelRange + */ + public QueryChannelRange clone() { + long ret = bindings.QueryChannelRange_clone(this.ptr); QueryChannelRange ret_hu_conv = new QueryChannelRange(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * \n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t + */ + public int end_blocknum() { + int ret = bindings.QueryChannelRange_end_blocknum(this.ptr); + return ret; + } + + /** + * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write + */ + public static Result_QueryChannelRangeDecodeErrorZ read(byte[] ser) { + long ret = bindings.QueryChannelRange_read(ser); + Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } - public byte[] write(QueryChannelRange obj) { - byte[] ret = bindings.QueryChannelRange_write(obj == null ? 0 : obj.ptr & ~1); - this.ptrs_to.add(obj); + /** + * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read + */ + public byte[] write() { + byte[] ret = bindings.QueryChannelRange_write(this.ptr); return ret; }