1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * A reference to a transaction output.
12 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
13 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class OutPoint extends CommonBase {
17 OutPoint(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.OutPoint_free(ptr); }
25 * The referenced transaction's txid.
27 public byte[] get_txid() {
28 byte[] ret = bindings.OutPoint_get_txid(this.ptr);
33 * The referenced transaction's txid.
35 public void set_txid(byte[] val) {
36 bindings.OutPoint_set_txid(this.ptr, val);
40 * The index of the referenced output in its transaction's vout.
42 public short get_index() {
43 short ret = bindings.OutPoint_get_index(this.ptr);
48 * The index of the referenced output in its transaction's vout.
50 public void set_index(short val) {
51 bindings.OutPoint_set_index(this.ptr, val);
55 * Constructs a new OutPoint given each field
57 public static OutPoint constructor_new(byte[] txid_arg, short index_arg) {
58 long ret = bindings.OutPoint_new(txid_arg, index_arg);
59 OutPoint ret_hu_conv = new OutPoint(null, ret);
60 ret_hu_conv.ptrs_to.add(ret_hu_conv);
65 * Creates a copy of the OutPoint
67 public OutPoint clone() {
68 long ret = bindings.OutPoint_clone(this.ptr);
69 OutPoint ret_hu_conv = new OutPoint(null, ret);
70 ret_hu_conv.ptrs_to.add(this);
75 * Convert an `OutPoint` to a lightning channel id.
77 public byte[] to_channel_id() {
78 byte[] ret = bindings.OutPoint_to_channel_id(this.ptr);
83 * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
85 public byte[] write() {
86 byte[] ret = bindings.OutPoint_write(this.ptr);
91 * Read a OutPoint from a byte array, created by OutPoint_write
93 public static Result_OutPointDecodeErrorZ constructor_read(byte[] ser) {
94 long ret = bindings.OutPoint_read(ser);
95 Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret);