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 byte[] ret = bindings.OutPoint_get_txid(this.ptr);
31 * The referenced transaction's txid.
33 public void set_txid(byte[] val) {
34 bindings.OutPoint_set_txid(this.ptr, InternalUtils.check_arr_len(val, 32));
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);
49 * The index of the referenced output in its transaction's vout.
51 public void set_index(short val) {
52 bindings.OutPoint_set_index(this.ptr, val);
58 * Constructs a new OutPoint given each field
60 public static OutPoint of(byte[] txid_arg, short index_arg) {
61 long ret = bindings.OutPoint_new(InternalUtils.check_arr_len(txid_arg, 32), index_arg);
62 GC.KeepAlive(txid_arg);
63 GC.KeepAlive(index_arg);
64 if (ret >= 0 && ret <= 4096) { return null; }
65 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
66 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70 internal long clone_ptr() {
71 long ret = bindings.OutPoint_clone_ptr(this.ptr);
77 * Creates a copy of the OutPoint
79 public OutPoint clone() {
80 long ret = bindings.OutPoint_clone(this.ptr);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
89 * Checks if two OutPoints contain equal inner contents.
90 * This ignores pointers and is_owned flags and looks at the values in fields.
91 * Two objects with NULL inner values will be considered "equal" here.
93 public bool eq(org.ldk.structs.OutPoint b) {
94 bool ret = bindings.OutPoint_eq(this.ptr, b == null ? 0 : b.ptr);
97 if (this != null) { this.ptrs_to.AddLast(b); };
101 public override bool Equals(object o) {
102 if (!(o is OutPoint)) return false;
103 return this.eq((OutPoint)o);
106 * Checks if two OutPoints contain equal inner contents.
109 long ret = bindings.OutPoint_hash(this.ptr);
114 public override int GetHashCode() {
115 return (int)this.hash();
118 * Convert an `OutPoint` to a lightning channel id.
120 public byte[] to_channel_id() {
121 byte[] ret = bindings.OutPoint_to_channel_id(this.ptr);
127 * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
129 public byte[] write() {
130 byte[] ret = bindings.OutPoint_write(this.ptr);
136 * Read a OutPoint from a byte array, created by OutPoint_write
138 public static Result_OutPointDecodeErrorZ read(byte[] ser) {
139 long ret = bindings.OutPoint_read(ser);
141 if (ret >= 0 && ret <= 4096) { return null; }
142 Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret);