@@ -42,6 +42,45 @@ public void block_connected(byte[] header, TwoTuple<Long, byte[]>[] txdata, int
4242 /* TODO 2 TwoTuple<Long, byte[]> */ ;
4343 }
4444
45+ /**
46+ * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
47+ * of a channel and reacting accordingly to newly confirmed transactions. For details, see
48+ * [`ChannelMonitor::transactions_confirmed`].
49+ *
50+ * Used instead of [`block_connected`] by clients that are notified of transactions rather than
51+ * blocks. May be called before or after [`update_best_block`] for transactions in the
52+ * corresponding block. See [`update_best_block`] for further calling expectations.
53+ *
54+ * [`block_connected`]: Self::block_connected
55+ * [`update_best_block`]: Self::update_best_block
56+ */
57+ public void transactions_confirmed (byte [] header , TwoTuple <Long , byte []>[] txdata , int height ) {
58+ bindings .ChainMonitor_transactions_confirmed (this .ptr , header , Arrays .stream (txdata ).mapToLong (txdata_conv_24 -> bindings .C2Tuple_usizeTransactionZ_new (txdata_conv_24 .a , txdata_conv_24 .b )).toArray (), height );
59+ /* TODO 2 TwoTuple<Long, byte[]> */ ;
60+ }
61+
62+ /**
63+ * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
64+ * of a channel and reacting accordingly based on the new chain tip. For details, see
65+ * [`ChannelMonitor::update_best_block`].
66+ *
67+ * Used instead of [`block_connected`] by clients that are notified of transactions rather than
68+ * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
69+ * block.
70+ *
71+ * Must be called after new blocks become available for the most recent block. Intermediary
72+ * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
73+ * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
74+ * for any affected transactions.
75+ *
76+ * [`block_connected`]: Self::block_connected
77+ * [`transactions_confirmed`]: Self::transactions_confirmed
78+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
79+ */
80+ public void update_best_block (byte [] header , int height ) {
81+ bindings .ChainMonitor_update_best_block (this .ptr , header , height );
82+ }
83+
4584 /**
4685 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4786 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
@@ -51,6 +90,30 @@ public void block_disconnected(byte[] header, int disconnected_height) {
5190 bindings .ChainMonitor_block_disconnected (this .ptr , header , disconnected_height );
5291 }
5392
93+ /**
94+ * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
95+ * of a channel based on transactions unconfirmed as a result of a chain reorganization. See
96+ * [`ChannelMonitor::transaction_unconfirmed`] for details.
97+ *
98+ * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
99+ * than blocks. May be called before or after [`update_best_block`] for transactions in the
100+ * corresponding block. See [`update_best_block`] for further calling expectations.
101+ *
102+ * [`block_disconnected`]: Self::block_disconnected
103+ * [`update_best_block`]: Self::update_best_block
104+ */
105+ public void transaction_unconfirmed (byte [] txid ) {
106+ bindings .ChainMonitor_transaction_unconfirmed (this .ptr , txid );
107+ }
108+
109+ /**
110+ * Returns the set of txids that should be monitored for re-organization out of the chain.
111+ */
112+ public byte [][] get_relevant_txids () {
113+ byte [][] ret = bindings .ChainMonitor_get_relevant_txids (this .ptr );
114+ return ret ;
115+ }
116+
54117 /**
55118 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
56119 *
0 commit comments