-
Notifications
You must be signed in to change notification settings - Fork 38.8k
p2p: Reduce inv traffic during IBD #19204
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
Conversation
|
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. |
|
Good observation. Concept ACK on solving this inefficiency. Why we don't pretend it's a blocks-only connection at the beginning? I guess maybe because it's unknown before handshake. Maybe we can have a new message for this, but that's too much of an overkill... Do you have any thoughts? |
|
I'd feel uncomfortable using bip37 for this. bloomfilters have been hidden behind a run time flag. It seems fragile to assume that full node implementations in the future are more likely to support bip37 message types than the feefilter message type. |
luke-jr
left a comment
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.
utACK
|
Concept ACK. |
|
utACK fa78c686ca5bcafa153d2f3813b77449fa31bb89. Nice idea. |
|
Concept ACK: neat idea! :) |
fac0135 to
fa8a66c
Compare
rajarshimaitra
left a comment
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.
Concept ACK. Neat Idea. Compiled without issue, all tests passing.
Was just wondering rpc_net is not really checking this situation, probably an unrelated change? Also, would it be possible to try having a functional test for this behavior?
Following is just a question for my own understanding.
|
Thanks for the review so far! The latest force push comes with those changes:
|
|
Concept ACK
One problem with that is that it's impossible to switch a blocks-only connection to a full connection. So it'd require dropping and reconnecting all connections after IBD. I'm not sure that's a good idea.
However I don't think @naumenkogs is suggesting to use BIP37 messages here, but the |
|
Jup, fRelay can't be changed while keeping the connection because subsequent version messages are ignored. Recycling the connection seems overly complex and potentially fragile. |
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.
Giant Concept ACK. I think doing this via feefilter is pretty elegant, since we can't change connection type, can't send a second version message with a new fRelay, and can't switch from blocksonly mode.
There's apparently a way to do this via fRelay by putting fRelay=False in the version message and then sending a filterclearlater (#8709). In my opinion, nodes not serving bloomfilters should just disconnect on filterclear.
An idea that I'm not super confident in: what about adding a P2P message to toggle fRelay on and off? (I think this is mentioned in gmaxwell's comment on #8709) and seems naumenkogs mentioned it too. I'm not sure what does/doesn't warrant a P2P protocol change.
|
A new message type wouldn't be understood by old nodes, making it less effective than the |
Github-Pull: bitcoin#19204 Rebased-From: fa8a66cf7e255884cb5cf061f43f42a7371e7ff4
|
utACK fa8a66cf7e255884cb5cf061f43f42a7371e7ff4 |
hebasto
left a comment
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.
ACK fa8a66cf7e255884cb5cf061f43f42a7371e7ff4, tested on Linux Mint 19.3 (x86_64):
$ ./test/functional/rpc_net.py
2020-06-12T07:26:00.331000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_nf7udywg
2020-06-12T07:26:00.801000Z TestFramework (INFO): Get out of IBD for the minfeefilter test
2020-06-12T07:26:00.805000Z TestFramework (INFO): Connect nodes both way
2020-06-12T07:26:01.008000Z TestFramework (INFO): Connect nodes both way
2020-06-12T07:26:01.453000Z TestFramework (INFO): Stopping nodes
2020-06-12T07:26:01.605000Z TestFramework (INFO): Cleaning up /tmp/bitcoin_func_test_nf7udywg on exit
2020-06-12T07:26:01.605000Z TestFramework (INFO): Tests successful
|
utACK fa8a66cf7e255884cb5cf061f43f42a7371e7ff4 |
jonatack
left a comment
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.
ACK fa8a66cf7e255884 a functional test in p2p_feefilter.py for the changes in fa8a66cf would be a good idea
|
If someone wants to write a functional test for this, I am happy to review. Otherwise, I will write one myself after merge. |
…isting filter msg disconnect logic 3a10d93 [p2p/refactor] move disconnect logic and remove misbehaving (gzhao408) ff8c430 [test] test disconnect for filterclear (gzhao408) 1c6b787 [netprocessing] disconnect node that sends filterclear (gzhao408) Pull request description: Nodes that don't have bloomfilters turned on (i.e. no `NODE_BLOOM` service) should disconnect peers that send them `filterclear` P2P messages. Non-bloomfilter nodes already disconnect peers for [`filteradd` and `filterload`](https://github.com/bitcoin/bitcoin/blob/19e919217e6d62e3640525e4149de1a4ae04e74f/src/net_processing.cpp#L2218), but #8709 removed `filterclear` so it could be used to reset tx relay. This isn't needed now because using `feefilter` message is much better for this purpose (See #19204). Also refactors existing disconnect logic for `filteradd` and `filterload` into respective message handlers and removes banning for them. ACKs for top commit: jnewbery: Code review ACK 3a10d93 naumenkogs: utACK 3a10d93 gillichu: tested ACK: quick test_runner on macOS [`3a10d93`](3a10d93) MarcoFalke: re-ACK 3a10d93 only change is replacing false with true 🚝 Tree-SHA512: 7aad8b3c0b0e776a47ad52544f0c1250feb242320f9a2962542f5905042f77e297a1486f8cdc3bf0fb93cd00c1ab66a67b2ec426eb6da3fe4cda56b5e623620f
fa8a66c to
fa525e4
Compare
|
ACK fa525e4 ( Haven't tested. Tried to build locally, but got a linker failure (which sounds Show platform data
Show signature data
/usr/bin/ld: bitcoin_wallet-bitcoin-wallet.o:(.data.rel.ro+0x8): undefined reference to `InitError(bilingual_str const&)' Tested on Linux-4.19.0-9-amd64-x86_64-with-glibc2.28 Configured with ./configure LDFLAGS=-L/home/james/src/bitcoin/db4/lib/ CPPFLAGS=-I/home/james/src/bitcoin/db4/include/ CXXFLAGS=-std=c++11 --enable-wallet --enable-debug --with-daemon Compiled with /usr/bin/ccache /usr/bin/g++ -std=c++11 -mavx -mavx2 -std=c++11 -fno-extended-identifiers -O0 -g3 -ftrapv -fstack-reuse=none -Wstack-protector -fstack-protector-all -msse4 -msha -msse4.1 -msse4.2 i Compiler version: g++ (Debian 8.3.0-6) 8.3.0 |
|
Jup, the gcc bug is unrelated and tracked in #19309 |
glozow
left a comment
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.
ACK fa525e4
I tested it functionally with this, confirms that the minfeefilter is set before/after IBD.
If someone wants to write a functional test for this, I am happy to review. Otherwise, I will write one myself after merge.
I'm not sure if this counts as a complete functional test 😅 this is kind of a draft that just checks minfeefilter (not any txrelay behavior) but I'd be down to do this.
|
For anyone who reviewed before the rebase, it should be trivial to re-ACK with |
|
utACK fa525e4 |
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.
re-ACK fa525e4 checked diff git range-diff 19612ca fa8a66c fa525e4, re-reviewed, ran tests, ran a custom p2p IBD behavior test at jonatack@9321e0f.
@gzhao408 in that link I adapted your test, feel free to use any or all of it for a PR.
hebasto
left a comment
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.
cb31ee0 [test] feefilter during and after IBD (gzhao408) Pull request description: This is a followup to #19204 which uses `minfeefilter=MAX_MONEY` to effectively shut off txrelay, thereby reducing inv traffic, when nodes are in IBD. It was [missing](bitcoin/bitcoin#19204 (comment)) a functional test. ACKs for top commit: jnewbery: utACK cb31ee0 Tree-SHA512: a9effc8193fa95fb42a2f9c66b258cc7b0941fc04c1ce3a6092f4426c9bfc7e72f702aca559b3e30e90652497f411f22fae3cf5cdb6cfd6ef6d37fed712cda67
|
Wouldn't the filterclear message be better to use for when tx invs are desired? I could be wrong, but I think this would (or should) request tx invs even if the connection was made with relay=0 (in the version message). |
|
Have you seen #19204 (comment) and #19260 ? |
Summary: ``` Tx-inv messages are ignored during IBD, so it would be nice if we told peers to not send them in the first place. Do that by sending two feefilter messages: One when the connection is made (and the node is in IBD), and another one when the node leaves IBD. ``` Backport of [[bitcoin/bitcoin#19204 | core#19204]]. Test Plan: ninja all check-all Run IBD. Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9330
Tx-inv messages are ignored during IBD, so it would be nice if we told peers to not send them in the first place. Do that by sending two
feefiltermessages: One when the connection is made (and the node is in IBD), and another one when the node leaves IBD.