Bitcoin Core  27.99.0
P2P Digital Currency
Namespaces | Functions | Variables
protocol.cpp File Reference
#include <protocol.h>
#include <common/system.h>
#include <atomic>
Include dependency graph for protocol.cpp:

Go to the source code of this file.

Namespaces

 NetMsgType
 Bitcoin protocol message types.
 

Functions

bool operator< (const CInv &a, const CInv &b)
 
const std::vector< std::string > & getAllNetMessageTypes ()
 
static std::string serviceFlagToStr (size_t bit)
 Convert a service flag (NODE_*) to a human readable string. More...
 
std::vector< std::string > serviceFlagsToStr (uint64_t flags)
 Convert service flags (a bitmask of NODE_*) to human readable strings. More...
 
GenTxid ToGenTxid (const CInv &inv)
 Convert a TX/WITNESS_TX/WTX CInv to a GenTxid. More...
 

Variables

const char * NetMsgType::VERSION = "version"
 The version message provides information about the transmitting node to the receiving node at the beginning of a connection. More...
 
const char * NetMsgType::VERACK = "verack"
 The verack message acknowledges a previously-received version message, informing the connecting node that it can begin to send other messages. More...
 
const char * NetMsgType::ADDR = "addr"
 The addr (IP address) message relays connection information for peers on the network. More...
 
const char * NetMsgType::ADDRV2 = "addrv2"
 The addrv2 message relays connection information for peers on the network just like the addr message, but is extended to allow gossiping of longer node addresses (see BIP155). More...
 
const char * NetMsgType::SENDADDRV2 = "sendaddrv2"
 The sendaddrv2 message signals support for receiving ADDRV2 messages (BIP155). More...
 
const char * NetMsgType::INV = "inv"
 The inv message (inventory message) transmits one or more inventories of objects known to the transmitting peer. More...
 
const char * NetMsgType::GETDATA = "getdata"
 The getdata message requests one or more data objects from another node. More...
 
const char * NetMsgType::MERKLEBLOCK = "merkleblock"
 The merkleblock message is a reply to a getdata message which requested a block using the inventory type MSG_MERKLEBLOCK. More...
 
const char * NetMsgType::GETBLOCKS = "getblocks"
 The getblocks message requests an inv message that provides block header hashes starting from a particular point in the block chain. More...
 
const char * NetMsgType::GETHEADERS = "getheaders"
 The getheaders message requests a headers message that provides block headers starting from a particular point in the block chain. More...
 
const char * NetMsgType::TX = "tx"
 The tx message transmits a single transaction. More...
 
const char * NetMsgType::HEADERS = "headers"
 The headers message sends one or more block headers to a node which previously requested certain headers with a getheaders message. More...
 
const char * NetMsgType::BLOCK = "block"
 The block message transmits a single serialized block. More...
 
const char * NetMsgType::GETADDR = "getaddr"
 The getaddr message requests an addr message from the receiving node, preferably one with lots of IP addresses of other receiving nodes. More...
 
const char * NetMsgType::MEMPOOL = "mempool"
 The mempool message requests the TXIDs of transactions that the receiving node has verified as valid but which have not yet appeared in a block. More...
 
const char * NetMsgType::PING = "ping"
 The ping message is sent periodically to help confirm that the receiving peer is still connected. More...
 
const char * NetMsgType::PONG = "pong"
 The pong message replies to a ping message, proving to the pinging node that the ponging node is still alive. More...
 
const char * NetMsgType::NOTFOUND = "notfound"
 The notfound message is a reply to a getdata message which requested an object the receiving node does not have available for relay. More...
 
const char * NetMsgType::FILTERLOAD = "filterload"
 The filterload message tells the receiving peer to filter all relayed transactions and requested merkle blocks through the provided filter. More...
 
const char * NetMsgType::FILTERADD = "filteradd"
 The filteradd message tells the receiving peer to add a single element to a previously-set bloom filter, such as a new public key. More...
 
const char * NetMsgType::FILTERCLEAR = "filterclear"
 The filterclear message tells the receiving peer to remove a previously-set bloom filter. More...
 
const char * NetMsgType::SENDHEADERS = "sendheaders"
 Indicates that a node prefers to receive new block announcements via a "headers" message rather than an "inv". More...
 
const char * NetMsgType::FEEFILTER = "feefilter"
 The feefilter message tells the receiving peer not to inv us any txs which do not meet the specified min fee rate. More...
 
const char * NetMsgType::SENDCMPCT = "sendcmpct"
 Contains a 1-byte bool and 8-byte LE version number. More...
 
const char * NetMsgType::CMPCTBLOCK = "cmpctblock"
 Contains a CBlockHeaderAndShortTxIDs object - providing a header and list of "short txids". More...
 
const char * NetMsgType::GETBLOCKTXN = "getblocktxn"
 Contains a BlockTransactionsRequest Peer should respond with "blocktxn" message. More...
 
const char * NetMsgType::BLOCKTXN = "blocktxn"
 Contains a BlockTransactions. More...
 
const char * NetMsgType::GETCFILTERS = "getcfilters"
 getcfilters requests compact filters for a range of blocks. More...
 
const char * NetMsgType::CFILTER = "cfilter"
 cfilter is a response to a getcfilters request containing a single compact filter. More...
 
const char * NetMsgType::GETCFHEADERS = "getcfheaders"
 getcfheaders requests a compact filter header and the filter hashes for a range of blocks, which can then be used to reconstruct the filter headers for those blocks. More...
 
const char * NetMsgType::CFHEADERS = "cfheaders"
 cfheaders is a response to a getcfheaders request containing a filter header and a vector of filter hashes for each subsequent block in the requested range. More...
 
const char * NetMsgType::GETCFCHECKPT = "getcfcheckpt"
 getcfcheckpt requests evenly spaced compact filter headers, enabling parallelized download and validation of the headers between them. More...
 
const char * NetMsgType::CFCHECKPT = "cfcheckpt"
 cfcheckpt is a response to a getcfcheckpt request containing a vector of evenly spaced filter headers for blocks on the requested chain. More...
 
const char * NetMsgType::WTXIDRELAY = "wtxidrelay"
 Indicates that a node prefers to relay transactions via wtxid, rather than txid. More...
 
const char * NetMsgType::SENDTXRCNCL = "sendtxrcncl"
 Contains a 4-byte version number and an 8-byte salt. More...
 
static const std::vector< std::string > g_all_net_message_types
 All known message types. More...
 

Function Documentation

◆ getAllNetMessageTypes()

const std::vector<std::string>& getAllNetMessageTypes ( )

Definition at line 167 of file protocol.cpp.

Here is the caller graph for this function:

◆ operator<()

bool operator< ( const CInv a,
const CInv b 
)

Definition at line 134 of file protocol.cpp.

◆ serviceFlagsToStr()

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[...]".

Parameters
[in]flagsmultiple NODE_* bitwise-OR-ed together

Definition at line 194 of file protocol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ serviceFlagToStr()

static std::string serviceFlagToStr ( size_t  bit)
static

Convert a service flag (NODE_*) to a human readable string.

It supports unknown service flags which will be returned as "UNKNOWN[...]".

Parameters
[in]bitthe service flag is calculated as (1 << bit)

Definition at line 177 of file protocol.cpp.

Here is the caller graph for this function:

◆ ToGenTxid()

GenTxid ToGenTxid ( const CInv inv)

Convert a TX/WITNESS_TX/WTX CInv to a GenTxid.

Definition at line 207 of file protocol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_all_net_message_types

const std::vector<std::string> g_all_net_message_types
static

All known message types.

Keep this in the same order as the list of messages above and in protocol.h.

Definition at line 53 of file protocol.cpp.