6 namespace org { namespace ldk { namespace structs {
10 * A descriptor used to sign for a commitment transaction's HTLC output.
12 public class HTLCDescriptor : CommonBase {
13 internal HTLCDescriptor(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.HTLCDescriptor_free(ptr); }
19 * The parameters required to derive the signer for the HTLC input.
21 public ChannelDerivationParameters get_channel_derivation_parameters() {
22 long ret = bindings.HTLCDescriptor_get_channel_derivation_parameters(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
26 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31 * The parameters required to derive the signer for the HTLC input.
33 public void set_channel_derivation_parameters(org.ldk.structs.ChannelDerivationParameters val) {
34 bindings.HTLCDescriptor_set_channel_derivation_parameters(this.ptr, val == null ? 0 : val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * The number of the commitment transaction in which the HTLC output lives.
43 public long get_per_commitment_number() {
44 long ret = bindings.HTLCDescriptor_get_per_commitment_number(this.ptr);
50 * The number of the commitment transaction in which the HTLC output lives.
52 public void set_per_commitment_number(long val) {
53 bindings.HTLCDescriptor_set_per_commitment_number(this.ptr, val);
59 * The key tweak corresponding to the number of the commitment transaction in which the HTLC
60 * output lives. This tweak is applied to all the basepoints for both parties in the channel to
61 * arrive at unique keys per commitment.
63 * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
65 public byte[] get_per_commitment_point() {
66 byte[] ret = bindings.HTLCDescriptor_get_per_commitment_point(this.ptr);
72 * The key tweak corresponding to the number of the commitment transaction in which the HTLC
73 * output lives. This tweak is applied to all the basepoints for both parties in the channel to
74 * arrive at unique keys per commitment.
76 * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
78 public void set_per_commitment_point(byte[] val) {
79 bindings.HTLCDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
85 * The details of the HTLC as it appears in the commitment transaction.
87 public HTLCOutputInCommitment get_htlc() {
88 long ret = bindings.HTLCDescriptor_get_htlc(this.ptr);
90 if (ret >= 0 && ret <= 4096) { return null; }
91 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
92 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
97 * The details of the HTLC as it appears in the commitment transaction.
99 public void set_htlc(org.ldk.structs.HTLCOutputInCommitment val) {
100 bindings.HTLCDescriptor_set_htlc(this.ptr, val == null ? 0 : val.ptr);
103 if (this != null) { this.ptrs_to.AddLast(val); };
107 * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
110 public Option_PaymentPreimageZ get_preimage() {
111 long ret = bindings.HTLCDescriptor_get_preimage(this.ptr);
113 if (ret >= 0 && ret <= 4096) { return null; }
114 org.ldk.structs.Option_PaymentPreimageZ ret_hu_conv = org.ldk.structs.Option_PaymentPreimageZ.constr_from_ptr(ret);
115 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
120 * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
123 public void set_preimage(org.ldk.structs.Option_PaymentPreimageZ val) {
124 bindings.HTLCDescriptor_set_preimage(this.ptr, val.ptr);
127 if (this != null) { this.ptrs_to.AddLast(val); };
131 * The counterparty's signature required to spend the HTLC output.
133 public byte[] get_counterparty_sig() {
134 byte[] ret = bindings.HTLCDescriptor_get_counterparty_sig(this.ptr);
140 * The counterparty's signature required to spend the HTLC output.
142 public void set_counterparty_sig(byte[] val) {
143 bindings.HTLCDescriptor_set_counterparty_sig(this.ptr, InternalUtils.check_arr_len(val, 64));
148 internal long clone_ptr() {
149 long ret = bindings.HTLCDescriptor_clone_ptr(this.ptr);
155 * Creates a copy of the HTLCDescriptor
157 public HTLCDescriptor clone() {
158 long ret = bindings.HTLCDescriptor_clone(this.ptr);
160 if (ret >= 0 && ret <= 4096) { return null; }
161 org.ldk.structs.HTLCDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCDescriptor(null, ret); }
162 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
167 * Checks if two HTLCDescriptors contain equal inner contents.
168 * This ignores pointers and is_owned flags and looks at the values in fields.
169 * Two objects with NULL inner values will be considered "equal" here.
171 public bool eq(org.ldk.structs.HTLCDescriptor b) {
172 bool ret = bindings.HTLCDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
175 if (this != null) { this.ptrs_to.AddLast(b); };
179 public override bool Equals(object o) {
180 if (!(o is HTLCDescriptor)) return false;
181 return this.eq((HTLCDescriptor)o);
184 * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
185 * being spent by the HTLC input in the HTLC transaction.
187 public OutPoint outpoint() {
188 long ret = bindings.HTLCDescriptor_outpoint(this.ptr);
190 if (ret >= 0 && ret <= 4096) { return null; }
191 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
192 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
197 * Returns the UTXO to be spent by the HTLC input, which can be obtained via
198 * [`Self::unsigned_tx_input`].
200 public TxOut previous_utxo() {
201 long ret = bindings.HTLCDescriptor_previous_utxo(this.ptr);
203 if (ret >= 0 && ret <= 4096) { return null; }
204 TxOut ret_conv = new TxOut(null, ret);
209 * Returns the unsigned transaction input spending the HTLC output in the commitment
212 public TxIn unsigned_tx_input() {
213 long ret = bindings.HTLCDescriptor_unsigned_tx_input(this.ptr);
215 if (ret >= 0 && ret <= 4096) { return null; }
216 TxIn ret_conv = new TxIn(null, ret);
221 * Returns the delayed output created as a result of spending the HTLC output in the commitment
224 public TxOut tx_output() {
225 long ret = bindings.HTLCDescriptor_tx_output(this.ptr);
227 if (ret >= 0 && ret <= 4096) { return null; }
228 TxOut ret_conv = new TxOut(null, ret);
233 * Returns the witness script of the HTLC output in the commitment transaction.
235 public byte[] witness_script() {
236 byte[] ret = bindings.HTLCDescriptor_witness_script(this.ptr);
242 * Returns the fully signed witness required to spend the HTLC output in the commitment
245 public byte[] tx_input_witness(byte[] signature, byte[] witness_script) {
246 byte[] ret = bindings.HTLCDescriptor_tx_input_witness(this.ptr, InternalUtils.check_arr_len(signature, 64), witness_script);
248 GC.KeepAlive(signature);
249 GC.KeepAlive(witness_script);
254 * Derives the channel signer required to sign the HTLC input.
256 public WriteableEcdsaChannelSigner derive_channel_signer(org.ldk.structs.SignerProvider signer_provider) {
257 long ret = bindings.HTLCDescriptor_derive_channel_signer(this.ptr, signer_provider.ptr);
259 GC.KeepAlive(signer_provider);
260 if (ret >= 0 && ret <= 4096) { return null; }
261 WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret);
262 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
263 if (this != null) { this.ptrs_to.AddLast(signer_provider); };