Skip to content

Commit ad36926

Browse files
committed
Improve 'Confirmed Transactions' section
1 parent 1551e16 commit ad36926

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

docs/blockchain_data/confirmed_transactions.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@ Up until this point, we've explored how to notify LDK of chain activity using
44
blocks. But what if you're sourcing chain activity from a place that doesn't
55
provide a block-centric interface, like Electrum?
66

7-
LDK has a `chain::Confirm` interface to support this use case, analogous to the
8-
block-oriented `chain::Listen` interface which we've been using up until now.
9-
With this alternative approach, you still need to give LDK block headers, but
10-
only for blocks containing transactions of interest. These are identified by
11-
`chain::Filter` as before. You also need to notify LDK of any transactions with
12-
insufficient confirmation that have been reorganized out of the chain. Use the
7+
LDK's `ChannelManager` and `ChainMonitor` have a `chain::Confirm` interface to
8+
support this use case, analogous to the block-oriented `chain::Listen`
9+
interface which we've been using up until now. With this alternative approach,
10+
you still need to give LDK information about chain activity, but only for
11+
transactions of interest. These are identified by
12+
`Confirm::get_relevant_txids`, as well as by `Filter`'s
13+
`register_tx`/`register_output` methods, just as before.
14+
15+
You also need to notify LDK of any transactions with insufficient confirmations
16+
that have been reorganized out of the chain. Use `Confirm`'s
1317
`transactions_confirmed` and `transaction_unconfirmed` methods, respectively.
1418

1519
Additionally, you must notify LDK whenever a new chain tip is available using
16-
the `best_block_updated` method. See the documentation for a full picture of how
17-
this interface is intended to be used.
20+
the `Confirm::best_block_updated` method. See the documentation for a full
21+
picture of how this interface is intended to be used.
22+
23+
::: tip Note
24+
Note that the described methods of `Confirm` have to be called both on the
25+
`ChannelManager` *and* the `ChainMonitor`.
26+
:::
1827

1928
::: tip Note
2029
Be advised that `chain::Confirm` is a less mature interface than
21-
`chain::Listen`. As such, there is not yet a utility like `lightning-block-sync`
22-
to use for interacting with clients like Electrum.
30+
`chain::Listen`. As such, there is not yet a utility like
31+
`lightning-block-sync` to use for interacting with clients like Electrum.
2332
:::

0 commit comments

Comments
 (0)