6 namespace org { namespace ldk { namespace structs {
10 * Exposes details around pending outbound HTLCs.
12 public class OutboundHTLCDetails : CommonBase {
13 internal OutboundHTLCDetails(object _dummy, long ptr) : base(ptr) { }
14 ~OutboundHTLCDetails() {
15 if (ptr != 0) { bindings.OutboundHTLCDetails_free(ptr); }
20 * The IDs are incremented by 1 starting from 0 for each offered HTLC.
21 * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced
22 * and not part of any commitment transaction.
24 * Not present when we are awaiting a remote revocation and the HTLC is not added yet.
26 public Option_u64Z get_htlc_id() {
27 long ret = bindings.OutboundHTLCDetails_get_htlc_id(this.ptr);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
31 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
37 * The IDs are incremented by 1 starting from 0 for each offered HTLC.
38 * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced
39 * and not part of any commitment transaction.
41 * Not present when we are awaiting a remote revocation and the HTLC is not added yet.
43 public void set_htlc_id(org.ldk.structs.Option_u64Z val) {
44 bindings.OutboundHTLCDetails_set_htlc_id(this.ptr, val.ptr);
47 if (this != null) { this.ptrs_to.AddLast(val); };
53 public long get_amount_msat() {
54 long ret = bindings.OutboundHTLCDetails_get_amount_msat(this.ptr);
62 public void set_amount_msat(long val) {
63 bindings.OutboundHTLCDetails_set_amount_msat(this.ptr, val);
69 * The block height at which this HTLC expires.
71 public int get_cltv_expiry() {
72 int ret = bindings.OutboundHTLCDetails_get_cltv_expiry(this.ptr);
78 * The block height at which this HTLC expires.
80 public void set_cltv_expiry(int val) {
81 bindings.OutboundHTLCDetails_set_cltv_expiry(this.ptr, val);
89 public byte[] get_payment_hash() {
90 long ret = bindings.OutboundHTLCDetails_get_payment_hash(this.ptr);
92 if (ret >= 0 && ret <= 4096) { return null; }
93 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
100 public void set_payment_hash(byte[] val) {
101 bindings.OutboundHTLCDetails_set_payment_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
107 * The state of the HTLC in the state machine.
109 * Determines on which commitment transactions the HTLC is included and what message the HTLC is
110 * waiting for to advance to the next state.
112 * See [`OutboundHTLCStateDetails`] for information on the specific states.
114 * LDK will always fill this field in, but when downgrading to prior versions of LDK, new
115 * states may result in `None` here.
117 public Option_OutboundHTLCStateDetailsZ get_state() {
118 long ret = bindings.OutboundHTLCDetails_get_state(this.ptr);
120 if (ret >= 0 && ret <= 4096) { return null; }
121 org.ldk.structs.Option_OutboundHTLCStateDetailsZ ret_hu_conv = org.ldk.structs.Option_OutboundHTLCStateDetailsZ.constr_from_ptr(ret);
122 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
127 * The state of the HTLC in the state machine.
129 * Determines on which commitment transactions the HTLC is included and what message the HTLC is
130 * waiting for to advance to the next state.
132 * See [`OutboundHTLCStateDetails`] for information on the specific states.
134 * LDK will always fill this field in, but when downgrading to prior versions of LDK, new
135 * states may result in `None` here.
137 public void set_state(org.ldk.structs.Option_OutboundHTLCStateDetailsZ val) {
138 bindings.OutboundHTLCDetails_set_state(this.ptr, val.ptr);
141 if (this != null) { this.ptrs_to.AddLast(val); };
145 * The extra fee being skimmed off the top of this HTLC.
147 public Option_u64Z get_skimmed_fee_msat() {
148 long ret = bindings.OutboundHTLCDetails_get_skimmed_fee_msat(this.ptr);
150 if (ret >= 0 && ret <= 4096) { return null; }
151 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
152 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
157 * The extra fee being skimmed off the top of this HTLC.
159 public void set_skimmed_fee_msat(org.ldk.structs.Option_u64Z val) {
160 bindings.OutboundHTLCDetails_set_skimmed_fee_msat(this.ptr, val.ptr);
163 if (this != null) { this.ptrs_to.AddLast(val); };
167 * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed
168 * from the local commitment transaction and added to the commitment transaction fee.
169 * For non-anchor channels, this takes into account the cost of the second-stage HTLC
170 * transactions as well.
172 * When the local commitment transaction is broadcasted as part of a unilateral closure,
173 * the value of this HTLC will therefore not be claimable but instead burned as a transaction
176 * Note that dust limits are specific to each party. An HTLC can be dust for the local
177 * commitment transaction but not for the counterparty's commitment transaction and vice versa.
179 public bool get_is_dust() {
180 bool ret = bindings.OutboundHTLCDetails_get_is_dust(this.ptr);
186 * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed
187 * from the local commitment transaction and added to the commitment transaction fee.
188 * For non-anchor channels, this takes into account the cost of the second-stage HTLC
189 * transactions as well.
191 * When the local commitment transaction is broadcasted as part of a unilateral closure,
192 * the value of this HTLC will therefore not be claimable but instead burned as a transaction
195 * Note that dust limits are specific to each party. An HTLC can be dust for the local
196 * commitment transaction but not for the counterparty's commitment transaction and vice versa.
198 public void set_is_dust(bool val) {
199 bindings.OutboundHTLCDetails_set_is_dust(this.ptr, val);
205 * Constructs a new OutboundHTLCDetails given each field
207 public static OutboundHTLCDetails of(org.ldk.structs.Option_u64Z htlc_id_arg, long amount_msat_arg, int cltv_expiry_arg, byte[] payment_hash_arg, org.ldk.structs.Option_OutboundHTLCStateDetailsZ state_arg, org.ldk.structs.Option_u64Z skimmed_fee_msat_arg, bool is_dust_arg) {
208 long ret = bindings.OutboundHTLCDetails_new(htlc_id_arg.ptr, amount_msat_arg, cltv_expiry_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash_arg, 32)), state_arg.ptr, skimmed_fee_msat_arg.ptr, is_dust_arg);
209 GC.KeepAlive(htlc_id_arg);
210 GC.KeepAlive(amount_msat_arg);
211 GC.KeepAlive(cltv_expiry_arg);
212 GC.KeepAlive(payment_hash_arg);
213 GC.KeepAlive(state_arg);
214 GC.KeepAlive(skimmed_fee_msat_arg);
215 GC.KeepAlive(is_dust_arg);
216 if (ret >= 0 && ret <= 4096) { return null; }
217 org.ldk.structs.OutboundHTLCDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutboundHTLCDetails(null, ret); }
218 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
219 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_id_arg); };
220 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(state_arg); };
221 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(skimmed_fee_msat_arg); };
225 internal long clone_ptr() {
226 long ret = bindings.OutboundHTLCDetails_clone_ptr(this.ptr);
232 * Creates a copy of the OutboundHTLCDetails
234 public OutboundHTLCDetails clone() {
235 long ret = bindings.OutboundHTLCDetails_clone(this.ptr);
237 if (ret >= 0 && ret <= 4096) { return null; }
238 org.ldk.structs.OutboundHTLCDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutboundHTLCDetails(null, ret); }
239 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
244 * Serialize the OutboundHTLCDetails object into a byte array which can be read by OutboundHTLCDetails_read
246 public byte[] write() {
247 long ret = bindings.OutboundHTLCDetails_write(this.ptr);
249 if (ret >= 0 && ret <= 4096) { return null; }
250 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
255 * Read a OutboundHTLCDetails from a byte array, created by OutboundHTLCDetails_write
257 public static Result_OutboundHTLCDetailsDecodeErrorZ read(byte[] ser) {
258 long ret = bindings.OutboundHTLCDetails_read(InternalUtils.encodeUint8Array(ser));
260 if (ret >= 0 && ret <= 4096) { return null; }
261 Result_OutboundHTLCDetailsDecodeErrorZ ret_hu_conv = Result_OutboundHTLCDetailsDecodeErrorZ.constr_from_ptr(ret);