X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FOutPoint.java;fp=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FOutPoint.java;h=42a79f04e686da3ca2603b6c48f1bcc13e003cb3;hb=1b870a3ffab1c0024411e30102bc6d198300f095;hp=d0c7edba75ad06e959af96172d93291a5b5140c8;hpb=246459dcbc3be28c38b4951140a5933f4b3aa024;p=ldk-java diff --git a/src/main/java/org/ldk/structs/OutPoint.java b/src/main/java/org/ldk/structs/OutPoint.java index d0c7edba..42a79f04 100644 --- a/src/main/java/org/ldk/structs/OutPoint.java +++ b/src/main/java/org/ldk/structs/OutPoint.java @@ -5,6 +5,13 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * A reference to a transaction output. + * + * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32 + * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way. + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class OutPoint extends CommonBase { OutPoint(Object _dummy, long ptr) { super(ptr); } @@ -14,24 +21,39 @@ public class OutPoint extends CommonBase { if (ptr != 0) { bindings.OutPoint_free(ptr); } } + /** + * The referenced transaction's txid. + */ public byte[] get_txid() { byte[] ret = bindings.OutPoint_get_txid(this.ptr); return ret; } + /** + * The referenced transaction's txid. + */ public void set_txid(byte[] val) { bindings.OutPoint_set_txid(this.ptr, val); } + /** + * The index of the referenced output in its transaction's vout. + */ public short get_index() { short ret = bindings.OutPoint_get_index(this.ptr); return ret; } + /** + * The index of the referenced output in its transaction's vout. + */ public void set_index(short val) { bindings.OutPoint_set_index(this.ptr, val); } + /** + * Constructs a new OutPoint given each field + */ public static OutPoint constructor_new(byte[] txid_arg, short index_arg) { long ret = bindings.OutPoint_new(txid_arg, index_arg); OutPoint ret_hu_conv = new OutPoint(null, ret); @@ -39,6 +61,9 @@ public class OutPoint extends CommonBase { return ret_hu_conv; } + /** + * Creates a copy of the OutPoint + */ public OutPoint clone() { long ret = bindings.OutPoint_clone(this.ptr); OutPoint ret_hu_conv = new OutPoint(null, ret); @@ -46,16 +71,25 @@ public class OutPoint extends CommonBase { return ret_hu_conv; } + /** + * Convert an `OutPoint` to a lightning channel id. + */ public byte[] to_channel_id() { byte[] ret = bindings.OutPoint_to_channel_id(this.ptr); return ret; } + /** + * Serialize the OutPoint object into a byte array which can be read by OutPoint_read + */ public byte[] write() { byte[] ret = bindings.OutPoint_write(this.ptr); return ret; } + /** + * Read a OutPoint from a byte array, created by OutPoint_write + */ public static Result_OutPointDecodeErrorZ constructor_read(byte[] ser) { long ret = bindings.OutPoint_read(ser); Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret);