Skip to content

Conversation

jnewbery
Copy link
Contributor

@jnewbery jnewbery commented May 21, 2020

Support getcfilters requests when -peerblockfilters is set.

Does not advertise compact filter support in version messages.

@jnewbery
Copy link
Contributor Author

This is the 4th PR taken from #18876. Please see that PR for details of the full changes to support BIP 157.

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

Concept ACK

@jnewbery
Copy link
Contributor Author

rebased on master and fixed failing test.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

ACK 1231f6b 🔁

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 -

Copy link
Contributor

@Empact Empact left a comment

Choose a reason for hiding this comment

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

Code Review ACK 90a0dff

nit: for 0139a1b, how about noting in the commit message where this was introduced?

jnewbery and others added 4 commits May 26, 2020 17:24
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.
@jnewbery
Copy link
Contributor Author

Thanks for the review @MarcoFalke and @Empact. I've addressed all of your review comments.

nit: for 0139a1b, how about noting in the commit message where this was introduced?

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.

@jnewbery jnewbery force-pushed the 2020-05-cfilters branch from 90a0dff to 9e36067 Compare May 26, 2020 21:42
@Empact
Copy link
Contributor

Empact commented May 26, 2020

re-Code Review ACK 9e36067

@DrahtBot
Copy link
Contributor

DrahtBot commented May 27, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, 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.

Copy link
Contributor

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

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

ACK 9e36067

}

std::vector<BlockFilter> filters;

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Consider removing blank line for consistency with ProcessGetCFHeaders.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do this if I need to retouch the branch.

static bool PrepareBlockFilterRequest(CNode* pfrom, const CChainParams& chain_params,
static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_params,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the "p" in pfrom stand for "pointer" or "peer"? Consider renaming if the former.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right that the p stands for pointer. I'll rename these if I need to retouch the branch.

@maflcko
Copy link
Member

maflcko commented May 29, 2020

re-ACK 9e36067 , only change is adding commit "[refactor] Pass CNode and CConnman by reference" 🥑

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

re-ACK 9e36067d8c , only change is adding commit "[refactor] Pass CNode and CConnman by reference" 🥑
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgbKwv+PwO//7eg2MRGhEr5p5hlfuT6GXbIG2KBBj2at35/XQLwuNfi/0S8Jv8a
4oga+orbWYA4bNjZkEt2boyO3mCiML5pKPSHbjaDBaltE/lzzurIE0dfG/O+fPpk
+Smsj3HbC8BOXxkKdaqYXtQs5519LN9ypbCbIW6mY7SGyov1wG3XsBdNtMlU5Ybt
G7KkpTsXpSYpXCUy+Q1Rh2+3s7fvYZQrpe3XZ3Z0Ztzyuct3XgMarj+ucJOEKZ6Y
DKtXl0h4XBqfwlc4ngMZuXqN/6Zk1wEne94Q3Hr19SjbDLkp/oeBbsjqUi69y+5n
4CSmVaqhr8HUtTxqp/+ADSf+PaMchYx/jrOOh/f+2SsA0KLIsTvuGdWPxmDse0so
LHxFrDmF5mHXt1hECV5zQQcWE5M/nS8WB6nGHEQQ0RO67nxPs6CaqIQmR1WZ1599
/DAw2B1oagwy+KBQMAZFHjBFGKWa5TXXb7fZsVFSiUIXaMGl9p9xxfe2kJ1mzm5X
BaTr8GqR
=/Tog
-----END PGP SIGNATURE-----

Timestamp of file with hash e987c18ac02e885972b23102e7c1c01949ebe68ab8a6bbda08846816f39e846a -

Copy link
Contributor

@fjahr fjahr left a comment

Choose a reason for hiding this comment

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

Code review ACK 9e36067

If you have to retouch maybe also fix the commit message in 11106a4. It still says -peercfilter instead of -peerblockfilter.

@@ -13,6 +13,7 @@
hash256,
msg_getcfcheckpt,
msg_getcfheaders,
msg_getcfilters,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit-ish: the comment up top in p2p_blockfilters.py is still missing cfilters.

Copy link
Member

Choose a reason for hiding this comment

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

Let's fix this up in a follow-up

@maflcko maflcko merged commit 07d0e0d into bitcoin:master May 31, 2020
@jnewbery jnewbery deleted the 2020-05-cfilters branch June 1, 2020 02:54
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 1, 2020
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
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

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.
 """

@jnewbery
Copy link
Contributor Author

jnewbery commented Jun 2, 2020

Thanks for the review @jonatack

  • the messages are defined in order [getcfilters, cfilter, getcfheaders, cfheaders, getcfcheckpt, cfcheckpt] in the BIP, so I think it makes sense to preserve that ordering in protocol.cpp.
  • test docstring is fixed in the next PR

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

post-merge Code Review ACK 9e36067

jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 19, 2020
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
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 16, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 18, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 19, 2021
thelazier pushed a commit to thelazier/dash that referenced this pull request Sep 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 12, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants