6 namespace org { namespace ldk { namespace structs {
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 public class OutPoint : CommonBase {
16 internal OutPoint(object _dummy, long ptr) : base(ptr) { }
18 if (ptr != 0) { bindings.OutPoint_free(ptr); }
22 * The referenced transaction's txid.
24 public byte[] get_txid() {
25 long ret = bindings.OutPoint_get_txid(this.ptr);
27 if (ret >= 0 && ret <= 4096) { return null; }
28 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
33 * The referenced transaction's txid.
35 public void set_txid(byte[] val) {
36 bindings.OutPoint_set_txid(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
42 * The index of the referenced output in its transaction's vout.
44 public short get_index() {
45 short ret = bindings.OutPoint_get_index(this.ptr);
51 * The index of the referenced output in its transaction's vout.
53 public void set_index(short val) {
54 bindings.OutPoint_set_index(this.ptr, val);
60 * Constructs a new OutPoint given each field
62 public static OutPoint of(byte[] txid_arg, short index_arg) {
63 long ret = bindings.OutPoint_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(txid_arg, 32)), index_arg);
64 GC.KeepAlive(txid_arg);
65 GC.KeepAlive(index_arg);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
72 internal long clone_ptr() {
73 long ret = bindings.OutPoint_clone_ptr(this.ptr);
79 * Creates a copy of the OutPoint
81 public OutPoint clone() {
82 long ret = bindings.OutPoint_clone(this.ptr);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91 * Checks if two OutPoints contain equal inner contents.
92 * This ignores pointers and is_owned flags and looks at the values in fields.
93 * Two objects with NULL inner values will be considered "equal" here.
95 public bool eq(org.ldk.structs.OutPoint b) {
96 bool ret = bindings.OutPoint_eq(this.ptr, b.ptr);
99 if (this != null) { this.ptrs_to.AddLast(b); };
103 public override bool Equals(object o) {
104 if (!(o is OutPoint)) return false;
105 return this.eq((OutPoint)o);
108 * Generates a non-cryptographic 64-bit hash of the OutPoint.
111 long ret = bindings.OutPoint_hash(this.ptr);
116 public override int GetHashCode() {
117 return (int)this.hash();
120 * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
122 public byte[] write() {
123 long ret = bindings.OutPoint_write(this.ptr);
125 if (ret >= 0 && ret <= 4096) { return null; }
126 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
131 * Read a OutPoint from a byte array, created by OutPoint_write
133 public static Result_OutPointDecodeErrorZ read(byte[] ser) {
134 long ret = bindings.OutPoint_read(InternalUtils.encodeUint8Array(ser));
136 if (ret >= 0 && ret <= 4096) { return null; }
137 Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret);