1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Information about an HTLC as it appears in a commitment transaction
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class HTLCOutputInCommitment extends CommonBase {
14 HTLCOutputInCommitment(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.HTLCOutputInCommitment_free(ptr); }
22 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24 * need to compare this value to whether the commitment transaction in question is that of
25 * the counterparty or our own.
27 public boolean get_offered() {
28 boolean ret = bindings.HTLCOutputInCommitment_get_offered(this.ptr);
33 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
34 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
35 * need to compare this value to whether the commitment transaction in question is that of
36 * the counterparty or our own.
38 public void set_offered(boolean val) {
39 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);
52 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
53 * this divided by 1000.
55 public void set_amount_msat(long val) {
56 bindings.HTLCOutputInCommitment_set_amount_msat(this.ptr, val);
60 * The CLTV lock-time at which this HTLC expires.
62 public int get_cltv_expiry() {
63 int ret = bindings.HTLCOutputInCommitment_get_cltv_expiry(this.ptr);
68 * The CLTV lock-time at which this HTLC expires.
70 public void set_cltv_expiry(int val) {
71 bindings.HTLCOutputInCommitment_set_cltv_expiry(this.ptr, val);
75 * The hash of the preimage which unlocks this HTLC.
77 public byte[] get_payment_hash() {
78 byte[] ret = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr);
83 * The hash of the preimage which unlocks this HTLC.
85 public void set_payment_hash(byte[] val) {
86 bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, val);
90 * The position within the commitment transactions' outputs. This may be None if the value is
91 * below the dust limit (in which case no output appears in the commitment transaction and the
92 * value is spent to additional transaction fees).
94 public Option_u32Z get_transaction_output_index() {
95 long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr);
96 Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret);
97 ret_hu_conv.ptrs_to.add(this);
102 * The position within the commitment transactions' outputs. This may be None if the value is
103 * below the dust limit (in which case no output appears in the commitment transaction and the
104 * value is spent to additional transaction fees).
106 public void set_transaction_output_index(Option_u32Z val) {
107 bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr);
111 * Constructs a new HTLCOutputInCommitment given each field
113 public static HTLCOutputInCommitment constructor_new(boolean offered_arg, long amount_msat_arg, int cltv_expiry_arg, byte[] payment_hash_arg, Option_u32Z transaction_output_index_arg) {
114 long ret = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg, transaction_output_index_arg.ptr);
115 HTLCOutputInCommitment ret_hu_conv = new HTLCOutputInCommitment(null, ret);
116 ret_hu_conv.ptrs_to.add(ret_hu_conv);
121 * Creates a copy of the HTLCOutputInCommitment
123 public HTLCOutputInCommitment clone() {
124 long ret = bindings.HTLCOutputInCommitment_clone(this.ptr);
125 HTLCOutputInCommitment ret_hu_conv = new HTLCOutputInCommitment(null, ret);
126 ret_hu_conv.ptrs_to.add(this);
131 * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
133 public byte[] write() {
134 byte[] ret = bindings.HTLCOutputInCommitment_write(this.ptr);
139 * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
141 public static Result_HTLCOutputInCommitmentDecodeErrorZ constructor_read(byte[] ser) {
142 long ret = bindings.HTLCOutputInCommitment_read(ser);
143 Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);