Expand `chain::Listen` trivially to accept filtered block data 2022-04-listen-filtered-blocks
authorMatt Corallo <git@bluematt.me>
Tue, 26 Apr 2022 15:03:39 +0000 (15:03 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 26 Apr 2022 19:14:19 +0000 (19:14 +0000)
commitd629a7edb7241eee7fde9f5ccdf1c481d2d6297b
tree6b9d54619da9ded93e0678727a73f33bd31c0ee0
parentd1b984d8648aae56454bc4cf57c3119511b42886
Expand `chain::Listen` trivially to accept filtered block data

The `chain::Listen` interface provides a block-connection-based
alternative to the `chain::Confirm` interface, which supports
providing transaction data at a time separate from the block
connection time.

For users who are downloading the full headers tree (e.g. from a
node over the Bitcoin P2P protocol) but who are not downloading
full blocks (e.g. because they're using BIP 157/158 filtering)
there is no API that matches exactly their event stream -
`chain::Listen` requries full blocks for each block,
`chain::Confirm` requires breaking each connection event into two
calls.

Given its incredibly trivial to take a `TransactionData` in
addition to a `Block` in `chain::Listen` we do so here, adding a
default-implementation `block_connected` which simply creates the
`TransactionData`, which ultimately all of the `chain::Listen`
implementations currently do anyway.

Closes #1128.
lightning-block-sync/src/init.rs
lightning-block-sync/src/test_utils.rs
lightning/src/chain/chainmonitor.rs
lightning/src/chain/channelmonitor.rs
lightning/src/chain/mod.rs
lightning/src/ln/channelmanager.rs