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 long ret = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr);
86 if (ret >= 0 && ret <= 4096) { return null; }
87 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
92 * The hash of the preimage which unlocks this HTLC.
94 public void set_payment_hash(byte[] val) {
95 bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
101 * The position within the commitment transactions' outputs. This may be None if the value is
102 * below the dust limit (in which case no output appears in the commitment transaction and the
103 * value is spent to additional transaction fees).
105 public Option_u32Z get_transaction_output_index() {
106 long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr);
108 if (ret >= 0 && ret <= 4096) { return null; }
109 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
115 * The position within the commitment transactions' outputs. This may be None if the value is
116 * below the dust limit (in which case no output appears in the commitment transaction and the
117 * value is spent to additional transaction fees).
119 public void set_transaction_output_index(org.ldk.structs.Option_u32Z val) {
120 bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr);
123 if (this != null) { this.ptrs_to.AddLast(val); };
127 * Constructs a new HTLCOutputInCommitment given each field
129 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) {
130 long ret = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash_arg, 32)), transaction_output_index_arg.ptr);
131 GC.KeepAlive(offered_arg);
132 GC.KeepAlive(amount_msat_arg);
133 GC.KeepAlive(cltv_expiry_arg);
134 GC.KeepAlive(payment_hash_arg);
135 GC.KeepAlive(transaction_output_index_arg);
136 if (ret >= 0 && ret <= 4096) { return null; }
137 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
138 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
139 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(transaction_output_index_arg); };
143 internal long clone_ptr() {
144 long ret = bindings.HTLCOutputInCommitment_clone_ptr(this.ptr);
150 * Creates a copy of the HTLCOutputInCommitment
152 public HTLCOutputInCommitment clone() {
153 long ret = bindings.HTLCOutputInCommitment_clone(this.ptr);
155 if (ret >= 0 && ret <= 4096) { return null; }
156 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
157 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
162 * Checks if two HTLCOutputInCommitments contain equal inner contents.
163 * This ignores pointers and is_owned flags and looks at the values in fields.
164 * Two objects with NULL inner values will be considered "equal" here.
166 public bool eq(org.ldk.structs.HTLCOutputInCommitment b) {
167 bool ret = bindings.HTLCOutputInCommitment_eq(this.ptr, b == null ? 0 : b.ptr);
170 if (this != null) { this.ptrs_to.AddLast(b); };
174 public override bool Equals(object o) {
175 if (!(o is HTLCOutputInCommitment)) return false;
176 return this.eq((HTLCOutputInCommitment)o);
179 * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
181 public byte[] write() {
182 long ret = bindings.HTLCOutputInCommitment_write(this.ptr);
184 if (ret >= 0 && ret <= 4096) { return null; }
185 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
190 * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
192 public static Result_HTLCOutputInCommitmentDecodeErrorZ read(byte[] ser) {
193 long ret = bindings.HTLCOutputInCommitment_read(InternalUtils.encodeUint8Array(ser));
195 if (ret >= 0 && ret <= 4096) { return null; }
196 Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);