6 namespace org { namespace ldk { namespace structs {
10 * Information about an HTLC as it appears in a commitment transaction
12 public class HTLCOutputInCommitment : CommonBase {
13 internal HTLCOutputInCommitment(object _dummy, long ptr) : base(ptr) { }
14 ~HTLCOutputInCommitment() {
15 if (ptr != 0) { bindings.HTLCOutputInCommitment_free(ptr); }
19 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
20 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
21 * need to compare this value to whether the commitment transaction in question is that of
22 * the counterparty or our own.
24 public bool get_offered() {
25 bool ret = bindings.HTLCOutputInCommitment_get_offered(this.ptr);
31 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
32 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
33 * need to compare this value to whether the commitment transaction in question is that of
34 * the counterparty or our own.
36 public void set_offered(bool val) {
37 bindings.HTLCOutputInCommitment_set_offered(this.ptr, val);
43 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
44 * this divided by 1000.
46 public long get_amount_msat() {
47 long ret = bindings.HTLCOutputInCommitment_get_amount_msat(this.ptr);
53 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
54 * this divided by 1000.
56 public void set_amount_msat(long val) {
57 bindings.HTLCOutputInCommitment_set_amount_msat(this.ptr, val);
63 * The CLTV lock-time at which this HTLC expires.
65 public int get_cltv_expiry() {
66 int ret = bindings.HTLCOutputInCommitment_get_cltv_expiry(this.ptr);
72 * The CLTV lock-time at which this HTLC expires.
74 public void set_cltv_expiry(int val) {
75 bindings.HTLCOutputInCommitment_set_cltv_expiry(this.ptr, val);
81 * The hash of the preimage which unlocks this HTLC.
83 public byte[] get_payment_hash() {
84 byte[] ret = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr);
90 * The hash of the preimage which unlocks this HTLC.
92 public void set_payment_hash(byte[] val) {
93 bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
99 * The position within the commitment transactions' outputs. This may be None if the value is
100 * below the dust limit (in which case no output appears in the commitment transaction and the
101 * value is spent to additional transaction fees).
103 public Option_u32Z get_transaction_output_index() {
104 long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr);
106 if (ret >= 0 && ret <= 4096) { return null; }
107 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
108 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
113 * The position within the commitment transactions' outputs. This may be None if the value is
114 * below the dust limit (in which case no output appears in the commitment transaction and the
115 * value is spent to additional transaction fees).
117 public void set_transaction_output_index(org.ldk.structs.Option_u32Z val) {
118 bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr);
121 if (this != null) { this.ptrs_to.AddLast(val); };
125 * Constructs a new HTLCOutputInCommitment given each field
127 public static HTLCOutputInCommitment of(bool offered_arg, long amount_msat_arg, int cltv_expiry_arg, byte[] payment_hash_arg, org.ldk.structs.Option_u32Z transaction_output_index_arg) {
128 long ret = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, InternalUtils.check_arr_len(payment_hash_arg, 32), transaction_output_index_arg.ptr);
129 GC.KeepAlive(offered_arg);
130 GC.KeepAlive(amount_msat_arg);
131 GC.KeepAlive(cltv_expiry_arg);
132 GC.KeepAlive(payment_hash_arg);
133 GC.KeepAlive(transaction_output_index_arg);
134 if (ret >= 0 && ret <= 4096) { return null; }
135 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
136 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
137 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(transaction_output_index_arg); };
141 internal long clone_ptr() {
142 long ret = bindings.HTLCOutputInCommitment_clone_ptr(this.ptr);
148 * Creates a copy of the HTLCOutputInCommitment
150 public HTLCOutputInCommitment clone() {
151 long ret = bindings.HTLCOutputInCommitment_clone(this.ptr);
153 if (ret >= 0 && ret <= 4096) { return null; }
154 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
155 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
160 * Checks if two HTLCOutputInCommitments contain equal inner contents.
161 * This ignores pointers and is_owned flags and looks at the values in fields.
162 * Two objects with NULL inner values will be considered "equal" here.
164 public bool eq(org.ldk.structs.HTLCOutputInCommitment b) {
165 bool ret = bindings.HTLCOutputInCommitment_eq(this.ptr, b == null ? 0 : b.ptr);
168 if (this != null) { this.ptrs_to.AddLast(b); };
172 public override bool Equals(object o) {
173 if (!(o is HTLCOutputInCommitment)) return false;
174 return this.eq((HTLCOutputInCommitment)o);
177 * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
179 public byte[] write() {
180 byte[] ret = bindings.HTLCOutputInCommitment_write(this.ptr);
186 * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
188 public static Result_HTLCOutputInCommitmentDecodeErrorZ read(byte[] ser) {
189 long ret = bindings.HTLCOutputInCommitment_read(ser);
191 if (ret >= 0 && ret <= 4096) { return null; }
192 Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);