* panics if the given update is not the next update by update_id.
*/
public Result_NoneNoneZ update_monitor(org.ldk.structs.ChannelMonitorUpdate updates, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) {
- long ret = bindings.ChannelMonitor_update_monitor(this.ptr, updates == null ? 0 : updates.ptr, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
+ long ret = bindings.ChannelMonitor_update_monitor(this.ptr, updates.ptr, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(updates);
Reference.reachabilityFence(broadcaster);
return ret_hu_conv;
}
+ /**
+ * Gets the channel_id of the channel this ChannelMonitor is monitoring for.
+ */
+ public ChannelId channel_id() {
+ long ret = bindings.ChannelMonitor_channel_id(this.ptr);
+ Reference.reachabilityFence(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+ return ret_hu_conv;
+ }
+
/**
* Gets a list of txids, with their output scripts (in the order they appear in the
* transaction), which we must learn about spends of via block_connected().
* calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
* have been registered.
*/
- public void load_outputs_to_watch(org.ldk.structs.Filter filter) {
- bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, filter.ptr);
+ public void load_outputs_to_watch(org.ldk.structs.Filter filter, org.ldk.structs.Logger logger) {
+ bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, filter.ptr, logger.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(filter);
+ Reference.reachabilityFence(logger);
if (this != null) { this.ptrs_to.add(filter); };
+ if (this != null) { this.ptrs_to.add(logger); };
}
/**
* [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel
*/
public CommitmentTransaction[] counterparty_commitment_txs_from_update(org.ldk.structs.ChannelMonitorUpdate update) {
- long[] ret = bindings.ChannelMonitor_counterparty_commitment_txs_from_update(this.ptr, update == null ? 0 : update.ptr);
+ long[] ret = bindings.ChannelMonitor_counterparty_commitment_txs_from_update(this.ptr, update.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(update);
int ret_conv_23_len = ret.length;
* to the commitment transaction being revoked, this will return a signed transaction, but
* the signature will not be valid.
*
- * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::EcdsaChannelSigner::sign_justice_revoked_output
+ * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_justice_revoked_output
* [`Persist`]: crate::chain::chainmonitor::Persist
*/
public Result_TransactionNoneZ sign_to_local_justice_tx(byte[] justice_tx, long input_idx, long value, long commitment_number) {
}
/**
- * Used by [`ChannelManager`] deserialization to broadcast the latest holder state if its copy
- * of the channel state was out-of-date.
- *
- * You may also use this to broadcast the latest local commitment transaction, either because
+ * You may use this to broadcast the latest local commitment transaction, either because
* a monitor update failed or because we've fallen behind (i.e. we've received proof that our
* counterparty side knows a revocation secret we gave them that they shouldn't know).
*
- * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
+ * Broadcasting these transactions in this manner is UNSAFE, as they allow counterparty
* side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
* close channel with their commitment transaction after a substantial amount of time. Best
* may be to contact the other node operator out-of-band to coordinate other options available
* to you.
- *
- * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
*/
- public byte[][] get_latest_holder_commitment_txn(org.ldk.structs.Logger logger) {
- byte[][] ret = bindings.ChannelMonitor_get_latest_holder_commitment_txn(this.ptr, logger.ptr);
+ public void broadcast_latest_holder_commitment_txn(org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) {
+ bindings.ChannelMonitor_broadcast_latest_holder_commitment_txn(this.ptr, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
Reference.reachabilityFence(this);
+ Reference.reachabilityFence(broadcaster);
+ Reference.reachabilityFence(fee_estimator);
Reference.reachabilityFence(logger);
+ if (this != null) { this.ptrs_to.add(broadcaster); };
+ if (this != null) { this.ptrs_to.add(fee_estimator); };
if (this != null) { this.ptrs_to.add(logger); };
- return ret;
}
/**
* [`get_outputs_to_watch`]: #method.get_outputs_to_watch
*/
public TwoTuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ[] block_connected(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) {
- long[] ret = bindings.ChannelMonitor_block_connected(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
+ long[] ret = bindings.ChannelMonitor_block_connected(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28.ptr).toArray() : null, height, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(header);
Reference.reachabilityFence(txdata);
* [`block_connected`]: Self::block_connected
*/
public TwoTuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ[] transactions_confirmed(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) {
- long[] ret = bindings.ChannelMonitor_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
+ long[] ret = bindings.ChannelMonitor_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28.ptr).toArray() : null, height, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(header);
Reference.reachabilityFence(txdata);
/**
* Returns the set of txids that should be monitored for re-organization out of the chain.
*/
- public TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ[] get_relevant_txids() {
+ public ThreeTuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ[] get_relevant_txids() {
long[] ret = bindings.ChannelMonitor_get_relevant_txids(this.ptr);
Reference.reachabilityFence(this);
- int ret_conv_49_len = ret.length;
- TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ[] ret_conv_49_arr = new TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ[ret_conv_49_len];
- for (int x = 0; x < ret_conv_49_len; x++) {
- long ret_conv_49 = ret[x];
- TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_hu_conv = new TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ(null, ret_conv_49);
- if (ret_conv_49_hu_conv != null) { ret_conv_49_hu_conv.ptrs_to.add(this); };
- ret_conv_49_arr[x] = ret_conv_49_hu_conv;
+ int ret_conv_54_len = ret.length;
+ ThreeTuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ[] ret_conv_54_arr = new ThreeTuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ[ret_conv_54_len];
+ for (int c = 0; c < ret_conv_54_len; c++) {
+ long ret_conv_54 = ret[c];
+ ThreeTuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_hu_conv = new ThreeTuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ(null, ret_conv_54);
+ if (ret_conv_54_hu_conv != null) { ret_conv_54_hu_conv.ptrs_to.add(this); };
+ ret_conv_54_arr[c] = ret_conv_54_hu_conv;
}
- return ret_conv_49_arr;
+ return ret_conv_54_arr;
}
/**
if (this != null) { this.ptrs_to.add(logger); };
}
+ /**
+ * Triggers rebroadcasts of pending claims from a force-closed channel after a transaction
+ * signature generation failure.
+ */
+ public void signer_unblocked(org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) {
+ bindings.ChannelMonitor_signer_unblocked(this.ptr, broadcaster.ptr, fee_estimator.ptr, logger.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(broadcaster);
+ Reference.reachabilityFence(fee_estimator);
+ Reference.reachabilityFence(logger);
+ if (this != null) { this.ptrs_to.add(broadcaster); };
+ if (this != null) { this.ptrs_to.add(fee_estimator); };
+ if (this != null) { this.ptrs_to.add(logger); };
+ }
+
/**
* Returns the descriptors for relevant outputs (i.e., those that we can spend) within the
* transaction if they exist and the transaction has at least [`ANTI_REORG_DELAY`]
return ret_conv_27_arr;
}
+ /**
+ * Checks if the monitor is fully resolved. Resolved monitor is one that has claimed all of
+ * its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set).
+ *
+ * This function returns true only if [`Self::get_claimable_balances`] has been empty for at least
+ * 4032 blocks as an additional protection against any bugs resulting in spuriously empty balance sets.
+ */
+ public boolean is_fully_resolved(org.ldk.structs.Logger logger) {
+ boolean ret = bindings.ChannelMonitor_is_fully_resolved(this.ptr, logger.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(logger);
+ if (this != null) { this.ptrs_to.add(logger); };
+ return ret;
+ }
+
/**
* Gets the balances in this channel which are either claimable by us if we were to
* force-close the channel now or which are claimable on-chain (possibly awaiting