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
net, rpc: expose high bandwidth mode state via getpeerinfo #19776
net, rpc: expose high bandwidth mode state via getpeerinfo #19776
Conversation
Concept/approach ACK, could add test coverage and release note (see #19731 for an example). |
Thanks for reviewing @jonatack! Added a release note, will add a functional test for this within the next days. |
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. |
Added a functional test to |
Concept ACK Would be nice to have |
Yes. Along with other new ones like |
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.
Tested and globally looks good. A few suggestions follow.
Concept ACK. I'd suggest putting "bip152" somewhere in the name of the field, as the concept of high bandwidth mode is very specific to that BIP (and really doesn't dramatically increase actual bandwidth, as an unqualified name may make seem). |
@sipa: Agreed that referring to the BIP in the name would make sense here. Before I take any further changes, I'd like to discuss the naming. Some suggestions:
Does anyone have preferrences here or any other idea? My favourite would simply be |
I agree with you. Might be good to have input from @TheBlueMatt or @gmaxwell. |
These seems fine, |
Concept ACK. |
// EDIT: Before there was a "rebased" comment there that was not accurate, I confused with another PR 🤦♂️ Currently |
edb4ad4
to
a286f89
Compare
Decided for the name |
The patch I carry locally for this calls it
but I don't think it matter other than it should mention BIP152. |
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 a286f89
Happy to re-review if you opt for the shorter naming.
a286f89
to
bff461c
Compare
Now that three people voted for the short version (instagibbs, jonatack, and indirectly also gmaxwell), I changed the RPC result fields to |
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 review ACK bff461c per git diff a286f89 bff461c
6384419 test: add parameterized constructor for msg_sendcmpct() (Sebastian Falbesoner) Pull request description: While working on the test for #19776 I noticed that creating a `sendcmpct` message is quite cumbersome -- due to the lack of a parameterized constructor, one needs to create an empty (that is, initialized with default values) object and then set the two fields one by one. This PR replaces the default constructor with a parameterized constructor and uses it in the test `p2p_compactblocks.py`, reducing LOC. No need to pollute the namespace with temporary throw-away message objects anymore. ACKs for top commit: guggero: Code review ACK 6384419. epson121: Code review ACK 6384419 Tree-SHA512: 3b58d276d714b73abc6cc98d1d52dec5f6026b33f03faaeb7dcbc5d83ac377555179f98b159b2b9ecc8957999c35a1dc082e3c69299c5fde4e35f1bd0587ce9d
bff461c
to
bc8cc02
Compare
Rebased on master and shortened the test by using the parameterized ctor for |
…cmpct() 6384419 test: add parameterized constructor for msg_sendcmpct() (Sebastian Falbesoner) Pull request description: While working on the test for bitcoin#19776 I noticed that creating a `sendcmpct` message is quite cumbersome -- due to the lack of a parameterized constructor, one needs to create an empty (that is, initialized with default values) object and then set the two fields one by one. This PR replaces the default constructor with a parameterized constructor and uses it in the test `p2p_compactblocks.py`, reducing LOC. No need to pollute the namespace with temporary throw-away message objects anymore. ACKs for top commit: guggero: Code review ACK 6384419. epson121: Code review ACK 6384419 Tree-SHA512: 3b58d276d714b73abc6cc98d1d52dec5f6026b33f03faaeb7dcbc5d83ac377555179f98b159b2b9ecc8957999c35a1dc082e3c69299c5fde4e35f1bd0587ce9d
Code review ACK bc8cc02 |
bc8cc02
to
4df1d12
Compare
Rebased on master (was needed after the recent merge of #17785). Thanks a lot for reviewing, jonatack and naumenkogs! |
reACK 4df1d12 |
Code review re-ACK 4df1d12 per |
Co-authored-by: Jon Atack <jon@atack.com>
4df1d12
to
343dc47
Compare
Rebased on master, changed the data type of the introduced high-bandwidth flags |
reACK 343dc47 |
re-ACK 343dc47 per |
Since there hasn't been any activity for more than three weeks: is there anything else I can do for this PR? It has two ACKs (jonatack, naumenkogs) and two Concept ACKs (sipa, practicalswift), I think it should be ready for merge. |
I reckon it's not a reflection on this PR (which seems good AFAICS), just that attention has been focused on reviewing key features before the feature freeze October 15 and now on fixing bugs before branch-off. After branch-off, I'm guessing that features in waiting like this one will see renewed attention (if not before). |
Looks like this has missed the feature freeze. Can be merged after Nov 1st |
…etpeerinfo 343dc47 test: add test for high-bandwidth mode states in getpeerinfo (Sebastian Falbesoner) dab6583 doc: release note for new getpeerinfo fields "bip152_hb_{from,to}" (Sebastian Falbesoner) a7ed00f rpc: expose high-bandwidth mode states via getpeerinfo (Sebastian Falbesoner) 30bc8fa net: save high-bandwidth mode states in CNodeStats (Sebastian Falbesoner) Pull request description: Fixes bitcoin#19676, "_For every peer expose through getpeerinfo RPC whether or not we selected them as HB peers, and whether or not they selected us as HB peers._" See [BIP152](https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki), in particular the [protocol flow diagram](https://github.com/bitcoin/bips/raw/master/bip-0152/protocol-flow.png). The newly introduced states are changed on the following places in the code: * on reception of a `SENDCMPCT` message with valid version, the field `m_highbandwidth_from` is changed depending on the first integer parameter in the message (1=high bandwidth, 0=low bandwidth), i.e. it just mirrors the field `CNodeState.fPreferHeaderAndIDs`. * after adding a `SENDCMPCT` message to the send queue, the field `m_highbandwidth_to` is changed depending on how the first integer parameter is set (same as above) Note that after receiving `VERACK`, the node also sends `SENDCMPCT`, but that is only to announce the preferred version and never selects high-bandwidth mode, hence there is no need to change the state variables there, which are initialized to `false` anyways. ACKs for top commit: naumenkogs: reACK 343dc47 jonatack: re-ACK 343dc47 per `git range-diff 7ea6499 4df1d12 343dc47` Tree-SHA512: f4999e6a935266812c2259a9b5dc459710037d3c9e938006d282557cc225e56128f72965faffb207fc60c6531fab1206db976dd8729a69e8ca29d4835317b99f
Summary: > net: save high-bandwidth mode states in CNodeStats > rpc: expose high-bandwidth mode states via getpeerinfo > doc: release note for new getpeerinfo fields "bip152_hb_{from,to}" > test: add test for high-bandwidth mode states in getpeerinfo This is a backport of [[bitcoin/bitcoin#19776 | core#19776]] Depends on D10961 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D10962
Fixes #19676, "For every peer expose through getpeerinfo RPC whether or not we selected them as HB peers, and whether or not they selected us as HB peers." See BIP152, in particular the protocol flow diagram. The newly introduced states are changed on the following places in the code:
SENDCMPCT
message with valid version, the fieldm_highbandwidth_from
is changed depending on the first integer parameter in the message (1=high bandwidth, 0=low bandwidth), i.e. it just mirrors the fieldCNodeState.fPreferHeaderAndIDs
.SENDCMPCT
message to the send queue, the fieldm_highbandwidth_to
is changed depending on how the first integer parameter is set (same as above)Note that after receiving
VERACK
, the node also sendsSENDCMPCT
, but that is only to announce the preferred version and never selects high-bandwidth mode, hence there is no need to change the state variables there, which are initialized tofalse
anyways.