return ret_hu_conv;
}
+ /**
+ * Signs the given [`PartiallySignedTransaction`] which spends the given [`SpendableOutputDescriptor`]s.
+ * The resulting inputs will be finalized and the PSBT will be ready for broadcast if there
+ * are no other inputs that need signing.
+ *
+ * Returns `Err(())` if the PSBT is missing a descriptor or if we fail to sign.
+ *
+ * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
+ * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
+ */
+ public Result_PartiallySignedTransactionNoneZ sign_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, byte[] psbt) {
+ long ret = bindings.KeysManager_sign_spendable_outputs_psbt(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, psbt);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(descriptors);
+ Reference.reachabilityFence(psbt);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_PartiallySignedTransactionNoneZ ret_hu_conv = Result_PartiallySignedTransactionNoneZ.constr_from_ptr(ret);
+ for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (this != null) { this.ptrs_to.add(descriptors_conv_27); }; };
+ return ret_hu_conv;
+ }
+
/**
* Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an
* output to the given change destination (if sufficient change value remains). The
* transaction will have a feerate, at least, of the given value.
*
+ * The `locktime` argument is used to set the transaction's locktime. If `None`, the
+ * transaction will have a locktime of 0. It it recommended to set this to the current block
+ * height to avoid fee sniping, unless you have some specific reason to use a different
+ * locktime.
+ *
* Returns `Err(())` if the output value is greater than the input value minus required fee,
* if a descriptor was duplicated, or if an output descriptor `script_pubkey`
* does not match the one we can spend.
* May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
* this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
*/
- public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight) {
- long ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight);
+ public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_PackedLockTimeZ locktime) {
+ long ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight, locktime.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(descriptors);
Reference.reachabilityFence(outputs);
Reference.reachabilityFence(change_destination_script);
Reference.reachabilityFence(feerate_sat_per_1000_weight);
+ Reference.reachabilityFence(locktime);
if (ret >= 0 && ret <= 4096) { return null; }
Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret);
for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (this != null) { this.ptrs_to.add(descriptors_conv_27); }; };
+ if (this != null) { this.ptrs_to.add(locktime); };
return ret_hu_conv;
}