net processing: Add support for getcfilters#19044
Conversation
|
This is the 4th PR taken from #18876. Please see that PR for details of the full changes to support BIP 157. |
6432b05 to
c93c94a
Compare
c93c94a to
1231f6b
Compare
|
rebased on master and fixed failing test. |
maflcko
left a comment
There was a problem hiding this comment.
ACK 1231f6b3ba 🔁
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK 1231f6b3ba 🔁
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhYrQv+IxEs+9TDoo1Lq/ba4oUD2SnLQmHUQmfVTu/+MIjw/cwY9DoZIwg6/iGs
6WwTmf8NwlNjAe9AHnrgDm1BhakIZYaXv+ZgCL7BRqpFujyh2jwjsDjMXWppMvjv
DSt1NsrRlinXQsjR7WCJXvNt6axnvCeRsqLeua+ZhIyF5kVwTPapaNVbNo91Wjgw
fRmBwxhI39ZnZpjljKGOF9x7cB5y0ySCeDy2FQqRDpBEkdprUoSu5KloEjD9nNge
t4dtogwO6rDARHPx9rZOekp5MnAAUS+hdUeUFV3Yiw08VVbTuEOCAeAsIB326fQm
QORabhfya6K8guMuvCXyThmIi79GmAti93ybgwDREIWmsMJj88H7vHn8AM5adMR8
Zu839huCzBaeEUk4SbD5CK7j/2E3cGMLQ5l63m+4AEkOCgj/nr5aXqZpIGuxKU4F
ETGWpimT3U2VioNHBzoov/59uge5rPNoSpnKZukOaSYn00Uum1BFlgrpqDDjY1Pb
0D3QC8b5
=uTse
-----END PGP SIGNATURE-----
Timestamp of file with hash 9f5d9f1dfb8cd50d63725419784f2b0521db1d74441352040b1817c8b21ec56f -
1231f6b to
90a0dff
Compare
Pass CNode and CConnman by reference instead of by pointer to ProcessGetCFCheckPt() and ProcessGetCFHeaders().
This only changes network serialization. Disk serialization does not include the filter_type and is defined in ReadFilterFromDisk()/WriteFilterToDisk().
Handle getcfilters request if -peercfilter is configured.
|
Thanks for the review @MarcoFalke and @Empact. I've addressed all of your review comments.
The default [de]serialization wasn't previously used anywhere, so I don't think this is necessary. It's trivial to look up the git blame for that line. |
90a0dff to
9e36067
Compare
|
re-Code Review ACK 9e36067 |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
| } | ||
|
|
||
| std::vector<BlockFilter> filters; | ||
|
|
There was a problem hiding this comment.
nit: Consider removing blank line for consistency with ProcessGetCFHeaders.
There was a problem hiding this comment.
I'll do this if I need to retouch the branch.
| * @return True if the request can be serviced. | ||
| */ | ||
| static bool PrepareBlockFilterRequest(CNode* pfrom, const CChainParams& chain_params, | ||
| static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_params, |
There was a problem hiding this comment.
Does the "p" in pfrom stand for "pointer" or "peer"? Consider renaming if the former.
There was a problem hiding this comment.
I think you're right that the p stands for pointer. I'll rename these if I need to retouch the branch.
|
re-ACK 9e36067 , only change is adding commit "[refactor] Pass CNode and CConnman by reference" 🥑 Show signature and timestampSignature: Timestamp of file with hash |
| hash256, | ||
| msg_getcfcheckpt, | ||
| msg_getcfheaders, | ||
| msg_getcfilters, |
There was a problem hiding this comment.
nit-ish: the comment up top in p2p_blockfilters.py is still missing cfilters.
There was a problem hiding this comment.
Let's fix this up in a follow-up
9e36067 [test] Add test for cfilters. (Jim Posen) 11106a4 [net processing] Message handling for getcfilters. (Jim Posen) e535670 [indexes] Fix default [de]serialization of BlockFilter. (Jim Posen) bb911ae [refactor] Pass CNode and CConnman by reference (John Newbery) Pull request description: Support `getcfilters` requests when `-peerblockfilters` is set. Does not advertise compact filter support in version messages. ACKs for top commit: Empact: re-Code Review ACK bitcoin@9e36067 MarcoFalke: re-ACK 9e36067 , only change is adding commit "[refactor] Pass CNode and CConnman by reference" 🥑 jkczyz: ACK 9e36067 fjahr: Code review ACK 9e36067 Tree-SHA512: b45b42a25905ef0bd9e195029185300c86856c87f78cbe17921f4a25e159ae0f6f003e61714fa43779017eb97cd89d3568419be88e47d19dc8095562939e7887
There was a problem hiding this comment.
ACK 9e36067
Two optional nits for follow-ups:
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -40,12 +40,12 @@ const char *SENDCMPCT="sendcmpct";
-const char *GETCFILTERS="getcfilters";
-const char *CFILTER="cfilter";
-const char *GETCFHEADERS="getcfheaders";
-const char *CFHEADERS="cfheaders";
const char *GETCFCHECKPT="getcfcheckpt";
const char *CFCHECKPT="cfcheckpt";
+const char *GETCFHEADERS="getcfheaders";
+const char *CFHEADERS="cfheaders";
+const char *GETCFILTERS="getcfilters";
+const char *CFILTER="cfilter";
--- a/test/functional/p2p_blockfilters.py
+++ b/test/functional/p2p_blockfilters.py
@@ -4,8 +4,8 @@
"""Tests NODE_COMPACT_FILTERS (BIP 157/158).
-Tests that a node configured with -blockfilterindex and -peerblockfilters can serve
-cfheaders and cfcheckpts.
+Tests that a node configured with -blockfilterindex and -peerblockfilters can
+serve cfcheckpt, cfheaders, and cfilters.
"""|
Thanks for the review @jonatack
|
Summary: ``` Support getcfilters requests when -peerblockfilters is set. Does not advertise compact filter support in version messages. ``` Backport of core [[bitcoin/bitcoin#19044 | PR19044]]. Depends on D8465. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D8469
Support
getcfiltersrequests when-peerblockfiltersis set.Does not advertise compact filter support in version messages.