-
Notifications
You must be signed in to change notification settings - Fork 368
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
Support filtered blocks in lightning-block-sync
#1706
Support filtered blocks in lightning-block-sync
#1706
Conversation
Codecov ReportBase: 90.84% // Head: 90.83% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1706 +/- ##
==========================================
- Coverage 90.84% 90.83% -0.02%
==========================================
Files 86 86
Lines 46448 46503 +55
Branches 46448 46503 +55
==========================================
+ Hits 42198 42243 +45
- Misses 4250 4260 +10
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
63c44a5
to
3d93a95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Sorry, needs rebase now cause the import fix got merged separately.
Still needs rebase to lose the first two commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once the outstanding feedback is addressed.
42c7067
to
445557e
Compare
Feel free to squash, looks like 66e863e can be dropped entirely? |
445557e
to
3675d29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code itself LGTM, I'm a bit unsure of how practical this is to use when we have to rescan, though? The API won't, AFAICT, allow the user to pass in dependent transaction data when they need to rescan. If I'm missing something feel free to merge, but for a really easy to use API here I feel like the poller needs to actually be in the filter path somehow and decide to rescan.
IIUC, for BIP 157/158 use case, the |
Ah, okay, right. So this probably should mention that in the docs, no? |
Yeah, good call. Just so I understand the more general use case, this is not Electrum but some custom server written to give back pre-filtered blocks with transactions matching |
Hmm? I read your comment there to be that the use-case for this is for clients wishing to download BIP 157/158 filters, then if they get a match, download the full block (eg via REST or RPC). This is not for electrum or a super-filtering server, more for the BIP 157/158 clients. |
What I meant was, besides BIP 157/158, is there a more general "pre-filtered blocks" use case that we wish to support with Also, it occurs to me that with |
Ahhh, probably not? I see your point about some proprietary protocol, and I guess we should support that, but...
Hmm, right, we'd have to adapt this to make it work. I'm not really sure it's worth it, though - most folks wanting to rescan are probably using electrum and just want Confirm. I do wonder if this has implications for the API here, though - we never actually want to return a filtered block cause that rescan-needed risk, we only want a "have block" and "don't need block" options. |
Yeah, I was going to suggest either making the docs clear that all filtered blocks must contain dependent transactions or changing the enum variant from |
Right, I suppose if someone had a bespoke filtering system that included all in-block dependents we could use that and keep the current API, but I'm not sure that exists? And it seems better to just require full-or-empty blocks than having the API be easy to accidentally screw up by failing to read docs. |
Updated accordingly. Though note that any bespoke implementation wouldn't be able to use |
LGTM, basically, feel free to squash. |
Expand the BlockSource trait to allow filtered blocks now that chain::Listen supports them (d629a7e). This makes it possible to use BIP 157/158 compact block filters with lightning-block-sync.
c190141
to
c1938e8
Compare
Expand the
BlockSource
trait to allow filtered blocks now thatchain::Listen
supports them. This makes it possible to use BIP 157/158 compact block filters withlightning-block-sync
.