![]() |
Bitcoin Core
24.99.0
P2P Digital Currency
|
#include <netaddress.h>
#include <primitives/transaction.h>
#include <serialize.h>
#include <streams.h>
#include <uint256.h>
#include <util/time.h>
#include <cstdint>
#include <limits>
#include <string>
Go to the source code of this file.
Classes | |
class | CMessageHeader |
Message header. More... | |
class | CAddress |
A CService with information about it as peer. More... | |
class | CInv |
inv message data More... | |
Namespaces | |
NetMsgType | |
Bitcoin protocol message types. | |
Enumerations | |
enum | ServiceFlags : uint64_t { NODE_NONE = 0 , NODE_NETWORK = (1 << 0) , NODE_BLOOM = (1 << 2) , NODE_WITNESS = (1 << 3) , NODE_COMPACT_FILTERS = (1 << 6) , NODE_NETWORK_LIMITED = (1 << 10) } |
nServices flags More... | |
enum | GetDataMsg : uint32_t { UNDEFINED = 0 , MSG_TX = 1 , MSG_BLOCK = 2 , MSG_WTX = 5 , MSG_FILTERED_BLOCK = 3 , MSG_CMPCT_BLOCK = 4 , MSG_WITNESS_BLOCK = MSG_BLOCK | MSG_WITNESS_FLAG , MSG_WITNESS_TX = MSG_TX | MSG_WITNESS_FLAG } |
getdata / inv message types. More... | |
Functions | |
const std::vector< std::string > & | getAllNetMessageTypes () |
std::vector< std::string > | serviceFlagsToStr (uint64_t flags) |
Convert service flags (a bitmask of NODE_*) to human readable strings. More... | |
ServiceFlags | GetDesirableServiceFlags (ServiceFlags services) |
Gets the set of service flags which are "desirable" for a given peer. More... | |
void | SetServiceFlagsIBDCache (bool status) |
Set the current IBD status in order to figure out the desirable service flags. More... | |
static bool | HasAllDesirableServiceFlags (ServiceFlags services) |
A shortcut for (services & GetDesirableServiceFlags(services)) == GetDesirableServiceFlags(services), ie determines whether the given set of service flags are sufficient for a peer to be "relevant". More... | |
static bool | MayHaveUsefulAddressDB (ServiceFlags services) |
Checks if a peer with the given service flags may be capable of having a robust address-storage DB. More... | |
GenTxid | ToGenTxid (const CInv &inv) |
Convert a TX/WITNESS_TX/WTX CInv to a GenTxid. More... | |
Variables | |
const uint32_t | MSG_WITNESS_FLAG = 1 << 30 |
getdata message type flags More... | |
const uint32_t | MSG_TYPE_MASK = 0xffffffff >> 2 |
enum GetDataMsg : uint32_t |
getdata / inv message types.
These numbers are defined by the protocol. When adding a new value, be sure to mention it in the respective BIP.
Definition at line 461 of file protocol.h.
enum ServiceFlags : uint64_t |
nServices flags
Enumerator | |
---|---|
NODE_NONE | |
NODE_NETWORK | |
NODE_BLOOM | |
NODE_WITNESS | |
NODE_COMPACT_FILTERS | |
NODE_NETWORK_LIMITED |
Definition at line 273 of file protocol.h.
const std::vector<std::string>& getAllNetMessageTypes | ( | ) |
Definition at line 181 of file protocol.cpp.
ServiceFlags GetDesirableServiceFlags | ( | ServiceFlags | services | ) |
Gets the set of service flags which are "desirable" for a given peer.
These are the flags which are required for a peer to support for them to be "interesting" to us, ie for us to wish to use one of our few outbound connection slots for or for us to wish to prioritize keeping their connection around.
Relevant service flags may be peer- and state-specific in that the version of the peer may determine which flags are required (eg in the case of NODE_NETWORK_LIMITED where we seek out NODE_NETWORK peers unless they set NODE_NETWORK_LIMITED and we are out of IBD, in which case NODE_NETWORK_LIMITED suffices).
Thus, generally, avoid calling with peerServices == NODE_NONE, unless state-specific flags must absolutely be avoided. When called with peerServices == NODE_NONE, the returned desirable service flags are guaranteed to not change dependent on state - ie they are suitable for use when describing peers which we know to be desirable, but for which we do not have a confirmed set of service flags.
If the NODE_NONE return value is changed, contrib/seeds/makeseeds.py should be updated appropriately to filter for the same nodes.
Definition at line 129 of file protocol.cpp.
|
inlinestatic |
A shortcut for (services & GetDesirableServiceFlags(services)) == GetDesirableServiceFlags(services), ie determines whether the given set of service flags are sufficient for a peer to be "relevant".
Definition at line 345 of file protocol.h.
|
inlinestatic |
Checks if a peer with the given service flags may be capable of having a robust address-storage DB.
Definition at line 354 of file protocol.h.
std::vector<std::string> serviceFlagsToStr | ( | uint64_t | flags | ) |
Convert service flags (a bitmask of NODE_*) to human readable strings.
It supports unknown service flags which will be returned as "UNKNOWN[...]".
[in] | flags | multiple NODE_* bitwise-OR-ed together |
Definition at line 207 of file protocol.cpp.
void SetServiceFlagsIBDCache | ( | bool | status | ) |
Set the current IBD status in order to figure out the desirable service flags.
Definition at line 136 of file protocol.cpp.
Convert a TX/WITNESS_TX/WTX CInv to a GenTxid.
Definition at line 220 of file protocol.cpp.
const uint32_t MSG_TYPE_MASK = 0xffffffff >> 2 |
Definition at line 455 of file protocol.h.
const uint32_t MSG_WITNESS_FLAG = 1 << 30 |
getdata message type flags
Definition at line 454 of file protocol.h.