mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #19776: net, rpc: expose high bandwidth mode state via getpeerinfo
343dc4760ftest: add test for high-bandwidth mode states in getpeerinfo (Sebastian Falbesoner)dab6583307doc: release note for new getpeerinfo fields "bip152_hb_{from,to}" (Sebastian Falbesoner)a7ed00f8bbrpc: expose high-bandwidth mode states via getpeerinfo (Sebastian Falbesoner)30bc8fab68net: 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: reACK343dc4760fjonatack: re-ACK343dc4760fper `git range-diff7ea64994df1d12 343dc47` Tree-SHA512: f4999e6a935266812c2259a9b5dc459710037d3c9e938006d282557cc225e56128f72965faffb207fc60c6531fab1206db976dd8729a69e8ca29d4835317b99f
This commit is contained in:
@@ -697,6 +697,8 @@ public:
|
||||
std::string cleanSubVer;
|
||||
bool fInbound;
|
||||
bool m_manual_connection;
|
||||
bool m_bip152_highbandwidth_to;
|
||||
bool m_bip152_highbandwidth_from;
|
||||
int nStartingHeight;
|
||||
uint64_t nSendBytes;
|
||||
mapMsgCmdSize mapSendBytesPerMsgCmd;
|
||||
@@ -984,6 +986,10 @@ protected:
|
||||
public:
|
||||
uint256 hashContinue;
|
||||
std::atomic<int> nStartingHeight{-1};
|
||||
// We selected peer as (compact blocks) high-bandwidth peer (BIP152)
|
||||
std::atomic<bool> m_bip152_highbandwidth_to{false};
|
||||
// Peer selected us as (compact blocks) high-bandwidth peer (BIP152)
|
||||
std::atomic<bool> m_bip152_highbandwidth_from{false};
|
||||
|
||||
// flood relay
|
||||
std::vector<CAddress> vAddrToSend;
|
||||
|
||||
Reference in New Issue
Block a user