+ /**
+ * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
+ */
+ public TwoTuple_OutPointScriptZ get_funding_txo() {
+ long ret = bindings.ChannelMonitor_get_funding_txo(this.ptr);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ TwoTuple_OutPointScriptZ ret_hu_conv = new TwoTuple_OutPointScriptZ(null, ret);
+ 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().
+ */
+ public TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ[] get_outputs_to_watch() {
+ long[] ret = bindings.ChannelMonitor_get_outputs_to_watch(this.ptr);
+ TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ[] ret_conv_40_arr = new TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ[ret.length];
+ for (int o = 0; o < ret.length; o++) {
+ long ret_conv_40 = ret[o];
+ TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ ret_conv_40_hu_conv = new TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ(null, ret_conv_40);
+ ret_conv_40_hu_conv.ptrs_to.add(this);
+ ret_conv_40_arr[o] = ret_conv_40_hu_conv;
+ }
+ return ret_conv_40_arr;
+ }
+
+ /**
+ * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
+ * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
+ * have been registered.
+ */
+ public void load_outputs_to_watch(Filter filter) {
+ bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, filter == null ? 0 : filter.ptr);
+ this.ptrs_to.add(filter);
+ }
+
+ /**
+ * Get the list of HTLCs who's status has been updated on chain. This should be called by
+ * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
+ */
+ public MonitorEvent[] get_and_clear_pending_monitor_events() {
+ long[] ret = bindings.ChannelMonitor_get_and_clear_pending_monitor_events(this.ptr);
+ MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length];
+ for (int o = 0; o < ret.length; o++) {
+ long ret_conv_14 = ret[o];
+ MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14);
+ ret_conv_14_hu_conv.ptrs_to.add(this);
+ ret_conv_14_arr[o] = ret_conv_14_hu_conv;
+ }
+ return ret_conv_14_arr;
+ }
+
+ /**
+ * Gets the list of pending events which were generated by previous actions, clearing the list
+ * in the process.
+ *
+ * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
+ * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
+ * no internal locking in ChannelMonitors.
+ */
+ public Event[] get_and_clear_pending_events() {
+ long[] ret = bindings.ChannelMonitor_get_and_clear_pending_events(this.ptr);
+ Event[] ret_conv_7_arr = new Event[ret.length];
+ for (int h = 0; h < ret.length; h++) {
+ long ret_conv_7 = ret[h];
+ Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7);
+ ret_conv_7_hu_conv.ptrs_to.add(this);
+ ret_conv_7_arr[h] = ret_conv_7_hu_conv;
+ }
+ return ret_conv_7_arr;
+ }
+
+ /**
+ * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
+ * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
+ * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
+ * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
+ * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
+ * broadcast them if counterparty don't close channel with his higher commitment transaction after a
+ * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
+ * out-of-band the other node operator to coordinate with him if option is available to you.
+ * In any-case, choice is up to the user.
+ */
+ public byte[][] get_latest_holder_commitment_txn(Logger logger) {
+ byte[][] ret = bindings.ChannelMonitor_get_latest_holder_commitment_txn(this.ptr, logger == null ? 0 : logger.ptr);
+ this.ptrs_to.add(logger);
+ return ret;
+ }
+
+ /**
+ * Processes transactions in a newly connected block, which may result in any of the following:
+ * - update the monitor's state against resolved HTLCs
+ * - punish the counterparty in the case of seeing a revoked commitment transaction
+ * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
+ * - detect settled outputs for later spending
+ * - schedule and bump any in-flight claims
+ *
+ * Returns any new outputs to watch from `txdata`; after called, these are also included in
+ * [`get_outputs_to_watch`].
+ *
+ * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
+ */
+ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] block_connected(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, 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 == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr);
+ TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] ret_conv_39_arr = new TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[ret.length];
+ for (int n = 0; n < ret.length; n++) {
+ long ret_conv_39 = ret[n];
+ TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ ret_conv_39_hu_conv = new TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ(null, ret_conv_39);
+ ret_conv_39_hu_conv.ptrs_to.add(this);
+ ret_conv_39_arr[n] = ret_conv_39_hu_conv;
+ }
+ this.ptrs_to.add(broadcaster);
+ this.ptrs_to.add(fee_estimator);
+ this.ptrs_to.add(logger);
+ return ret_conv_39_arr;
+ }
+
+ /**
+ * Determines if the disconnected block contained any transactions of interest and updates
+ * appropriately.
+ */