+ long ret = bindings.ChannelManager_as_EventsProvider(this.ptr);
+ EventsProvider ret_hu_conv = new EventsProvider(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Constructs a new Listen which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
+ */
+ public Listen as_Listen() {
+ long ret = bindings.ChannelManager_as_Listen(this.ptr);
+ Listen ret_hu_conv = new Listen(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Updates channel state to take note of transactions which were confirmed in the given block
+ * at the given height.
+ *
+ * Note that you must still call (or have called) [`update_best_block`] with the block
+ * information which is included here.
+ *
+ * This method may be called before or after [`update_best_block`] for a given block's
+ * transaction data and may be called multiple times with additional transaction data for a
+ * given block.
+ *
+ * This method may be called for a previous block after an [`update_best_block`] call has
+ * been made for a later block, however it must *not* be called with transaction data from a
+ * block which is no longer in the best chain (ie where [`update_best_block`] has already
+ * been informed about a blockchain reorganization which no longer includes the block which
+ * corresponds to `header`).
+ *
+ * [`update_best_block`]: `Self::update_best_block`
+ */
+ public void transactions_confirmed(byte[] header, int height, TwoTuple<Long, byte[]>[] txdata) {
+ bindings.ChannelManager_transactions_confirmed(this.ptr, header, height, Arrays.stream(txdata).mapToLong(txdata_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_24.a, txdata_conv_24.b)).toArray());
+ /* TODO 2 TwoTuple<Long, byte[]> */;
+ }
+
+ /**
+ * Updates channel state with the current best blockchain tip. You should attempt to call this
+ * quickly after a new block becomes available, however if multiple new blocks become
+ * available at the same time, only a single `update_best_block()` call needs to be made.
+ *
+ * This method should also be called immediately after any block disconnections, once at the
+ * reorganization fork point, and once with the new chain tip. Calling this method at the
+ * blockchain reorganization fork point ensures we learn when a funding transaction which was
+ * previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
+ * accept payments which cannot be enforced on-chain.
+ *
+ * In both the block-connection and block-disconnection case, this method may be called either
+ * once per block connected or disconnected, or simply at the fork point and new tip(s),
+ * skipping any intermediary blocks.
+ */
+ public void update_best_block(byte[] header, int height) {
+ bindings.ChannelManager_update_best_block(this.ptr, header, height);
+ }
+
+ /**
+ * Gets the set of txids which should be monitored for their confirmation state.
+ *
+ * If you're providing information about reorganizations via [`transaction_unconfirmed`], this
+ * is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
+ *
+ * This may be useful to poll to determine the set of transactions which must be registered
+ * with an Electrum server or for which an Electrum server needs to be polled to determine
+ * transaction confirmation state.
+ *
+ * This may update after any [`transactions_confirmed`] or [`block_connected`] call.
+ *
+ * Note that this is NOT the set of transactions which must be included in calls to
+ * [`transactions_confirmed`] if they are confirmed, but a small subset of it.
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ * [`block_connected`]: chain::Listen::block_connected
+ */
+ public byte[][] get_relevant_txids() {
+ byte[][] ret = bindings.ChannelManager_get_relevant_txids(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Marks a transaction as having been reorganized out of the blockchain.
+ *
+ * If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
+ * of the blockchain, this function should be called to indicate that the transaction should
+ * be considered reorganized out.
+ *
+ * Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
+ * though this may be called repeatedly for a given transaction without issue.
+ *
+ * Note that if the transaction is confirmed on the main chain in a different block (indicated
+ * via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
+ * be very wary of race-conditions wherein the final state of a transaction indicated via
+ * these APIs is not the same as its state on the blockchain.
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`get_relevant_txids`]: Self::get_relevant_txids
+ */
+ public void transaction_unconfirmed(byte[] txid) {
+ bindings.ChannelManager_transaction_unconfirmed(this.ptr, txid);
+ }
+
+ /**
+ * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
+ * indicating whether persistence is necessary. Only one listener on
+ * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
+ * up.
+ * Note that the feature `allow_wallclock_use` must be enabled to use this function.
+ */
+ public boolean await_persistable_update_timeout(long max_wait) {
+ boolean ret = bindings.ChannelManager_await_persistable_update_timeout(this.ptr, max_wait);