Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

@TheBlueMatt TheBlueMatt commented Apr 26, 2022

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.

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this close #1128 or is more work needed? Also maybe BIP 157/158 should be called out explicitly in the Listen docs as supported

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 lightningdevkit#1128.
@codecov-commenter
Copy link

Codecov Report

Merging #1453 (a41cbaa) into main (d1b984d) will decrease coverage by 0.01%.
The diff coverage is 93.33%.

❗ Current head a41cbaa differs from pull request most recent head d629a7e. Consider uploading reports for the commit d629a7e to get more accurate results

@@            Coverage Diff             @@
##             main    #1453      +/-   ##
==========================================
- Coverage   90.88%   90.87%   -0.02%     
==========================================
  Files          75       75              
  Lines       41474    41475       +1     
  Branches    41474    41475       +1     
==========================================
- Hits        37695    37691       -4     
- Misses       3779     3784       +5     
Impacted Files Coverage Δ
lightning/src/chain/channelmonitor.rs 91.05% <ø> (ø)
lightning-block-sync/src/test_utils.rs 93.87% <75.00%> (ø)
lightning-block-sync/src/init.rs 95.80% <100.00%> (ø)
lightning/src/chain/chainmonitor.rs 97.63% <100.00%> (-0.02%) ⬇️
lightning/src/chain/mod.rs 68.18% <100.00%> (+7.07%) ⬆️
lightning/src/ln/channelmanager.rs 84.73% <100.00%> (-0.01%) ⬇️
lightning/src/ln/functional_tests.rs 97.07% <0.00%> (-0.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1b984d...d629a7e. Read the comment docs.

@valentinewallace valentinewallace merged commit 54e9c07 into lightningdevkit:main Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chain::Watch should probably support BIP 157/158

4 participants