diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-12-10 08:21:29 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-12-10 08:21:36 +0100 |
commit | 22f13c1e088e0e39b4ad17fdef302c22f672ea16 (patch) | |
tree | 2af13db673f4b223f34dd9f30bae59ce899770b5 /src/net.cpp | |
parent | f5b2ea3e591822c9cb132106f47a209f88c605d1 (diff) | |
parent | 343dc4760fd2407895fc8b3417a504b194429156 (diff) |
Merge #19776: net, rpc: expose high bandwidth mode state via getpeerinfo
343dc4760fd2407895fc8b3417a504b194429156 test: add test for high-bandwidth mode states in getpeerinfo (Sebastian Falbesoner)
dab6583307ceb7dd94affcc3482ddcc1a5747147 doc: release note for new getpeerinfo fields "bip152_hb_{from,to}" (Sebastian Falbesoner)
a7ed00f8bbc07dfc09f9e0a5bae10a1afe7612bb rpc: expose high-bandwidth mode states via getpeerinfo (Sebastian Falbesoner)
30bc8fab6833e0447ceadd3fff1566a680e33a98 net: save high-bandwidth mode states in CNodeStats (Sebastian Falbesoner)
Pull request description:
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](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 343dc4760fd2407895fc8b3417a504b194429156
jonatack:
re-ACK 343dc4760fd2407895fc8b3417a504b194429156 per `git range-diff 7ea6499 4df1d12 343dc47`
Tree-SHA512: f4999e6a935266812c2259a9b5dc459710037d3c9e938006d282557cc225e56128f72965faffb207fc60c6531fab1206db976dd8729a69e8ca29d4835317b99f
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp index d4746b4766..bbb85694e7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -584,6 +584,8 @@ void CNode::copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap) } stats.fInbound = IsInboundConn(); stats.m_manual_connection = IsManualConn(); + X(m_bip152_highbandwidth_to); + X(m_bip152_highbandwidth_from); X(nStartingHeight); { LOCK(cs_vSend); |