Skip to content

Mention ordering requirements #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions docs/blockchain_data/confirmed_transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ Up until this point, we've explored how to notify LDK of chain activity using
blocks. But what if you're sourcing chain activity from a place that doesn't
provide a block-centric interface, like Electrum?

LDK's `ChannelManager` and `ChainMonitor` implement a `chain::Confirm` interface to support this
use case, analogous to the block-oriented `chain::Listen` interface which we've been using up until
now. With this alternative approach, you still need to give LDK information about chain activity,
but only for transactions of interest. To this end, you must call `Confirm::transactions_confirmed`
when any transactions identified by `chain::Filter`'s `register_tx`/`register_output` methods are
confirmed.
LDK's `ChannelManager` and `ChainMonitor` implement a
[`chain::Confirm`](https://docs.rs/lightning/*/lightning/chain/trait.Confirm.html)
interface to support this use case, analogous to the block-oriented
[`chain::Listen`](https://docs.rs/lightning/*/lightning/chain/trait.Listen.html)
interface which we've been using up until now. With this alternative approach,
you still need to give LDK information about chain activity,
but only for transactions of interest. To this end, you must call
`Confirm::transactions_confirmed` when any transactions identified by
[`chain::Filter`](https://docs.rs/lightning/*/lightning/chain/trait.Filter.html)'s
`register_tx`/`register_output` methods are confirmed.

You also need to notify LDK of any transactions with insufficient confirmations
that have been reorganized out of the chain. Transactions that need to be monitored for such
Expand All @@ -20,6 +24,11 @@ Lastly, you must notify LDK whenever a new chain tip is available using
the `Confirm::best_block_updated` method. See the documentation for a full
picture of how this interface is intended to be used.

::: tip Note
Note that the described methods of `Confirm` must be called in accordance with the ordering requirements
described in the [`Confirm` documentation](https://docs.rs/lightning/*/lightning/chain/trait.Confirm.html#order)
:::

::: tip Note
Note that the described methods of `Confirm` must be called both on the
`ChannelManager` *and* the `ChainMonitor`.
Expand Down