Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

protocol.cpp File Reference
#include <protocol.h>
#include <util.h>
#include <utilstrencodings.h>
#include <arpa/inet.h>
+ Include dependency graph for protocol.cpp:

Go to the source code of this file.

Namespaces

 NetMsgType
 Bitcoin protocol message types.
 

Functions

static std::atomic< bool > g_initial_block_download_completed (false)
 
static const std::vector< std::string > allNetMessageTypesVec (allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes))
 
ServiceFlags GetDesirableServiceFlags (ServiceFlags services)
 Gets the set of service flags which are "desirable" for a given peer. More...
 
void SetServiceFlagsIBDCache (bool state)
 Set the current IBD status in order to figure out the desirable service flags. More...
 
bool operator< (const CInv &a, const CInv &b)
 
const std::vector< std::string > & getAllNetMessageTypes ()
 

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::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::REJECT ="reject"
 The reject message informs the receiving node that one of its previous messages has been rejected. 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::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::LEGACYTXLOCKREQUEST ="ix"
 
const char * NetMsgType::SPORK ="spork"
 
const char * NetMsgType::GETSPORKS ="getsporks"
 
const char * NetMsgType::DSACCEPT ="dsa"
 
const char * NetMsgType::DSVIN ="dsi"
 
const char * NetMsgType::DSFINALTX ="dsf"
 
const char * NetMsgType::DSSIGNFINALTX ="dss"
 
const char * NetMsgType::DSCOMPLETE ="dsc"
 
const char * NetMsgType::DSSTATUSUPDATE ="dssu"
 
const char * NetMsgType::DSTX ="dstx"
 
const char * NetMsgType::DSQUEUE ="dsq"
 
const char * NetMsgType::SENDDSQUEUE ="senddsq"
 
const char * NetMsgType::SYNCSTATUSCOUNT ="ssc"
 
const char * NetMsgType::MNGOVERNANCESYNC ="govsync"
 
const char * NetMsgType::MNGOVERNANCEOBJECT ="govobj"
 
const char * NetMsgType::MNGOVERNANCEOBJECTVOTE ="govobjvote"
 
const char * NetMsgType::GETMNLISTDIFF ="getmnlistd"
 
const char * NetMsgType::MNLISTDIFF ="mnlistdiff"
 
const char * NetMsgType::QSENDRECSIGS ="qsendrecsigs"
 
const char * NetMsgType::QFCOMMITMENT ="qfcommit"
 
const char * NetMsgType::QCONTRIB ="qcontrib"
 
const char * NetMsgType::QCOMPLAINT ="qcomplaint"
 
const char * NetMsgType::QJUSTIFICATION ="qjustify"
 
const char * NetMsgType::QPCOMMITMENT ="qpcommit"
 
const char * NetMsgType::QWATCH ="qwatch"
 
const char * NetMsgType::QSIGSESANN ="qsigsesann"
 
const char * NetMsgType::QSIGSHARESINV ="qsigsinv"
 
const char * NetMsgType::QGETSIGSHARES ="qgetsigs"
 
const char * NetMsgType::QBSIGSHARES ="qbsigs"
 
const char * NetMsgType::QSIGREC ="qsigrec"
 
const char * NetMsgType::QSIGSHARE ="qsigshare"
 
const char * NetMsgType::CLSIG ="clsig"
 
const char * NetMsgType::ISLOCK ="islock"
 
const char * NetMsgType::MNAUTH ="mnauth"
 
static const std::string allNetMessageTypes []
 All known message types. More...
 

Function Documentation

◆ allNetMessageTypesVec()

static const std::vector<std::string> allNetMessageTypesVec ( allNetMessageTypes  ,
allNetMessageTypes ARRAYLENallNetMessageTypes 
)
static

Referenced by getAllNetMessageTypes().

◆ g_initial_block_download_completed()

static std::atomic<bool> g_initial_block_download_completed ( false  )
static

◆ getAllNetMessageTypes()

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

Definition at line 293 of file protocol.cpp.

References allNetMessageTypesVec().

Referenced by CNode::CNode(), and ProcessMessage().

◆ GetDesirableServiceFlags()

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 dependant 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 201 of file protocol.cpp.

References g_initial_block_download_completed(), NODE_NETWORK, and NODE_NETWORK_LIMITED.

Referenced by convertSeed6(), HasAllDesirableServiceFlags(), ProcessMessage(), and CConnman::ThreadDNSAddressSeed().

◆ operator<()

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

Definition at line 238 of file protocol.cpp.

References CInv::hash, and CInv::type.

◆ SetServiceFlagsIBDCache()

void SetServiceFlagsIBDCache ( bool  state)

Set the current IBD status in order to figure out the desirable service flags.

Definition at line 208 of file protocol.cpp.

References g_initial_block_download_completed().

Referenced by PeerLogicValidation::UpdatedBlockTip().

Variable Documentation

◆ allNetMessageTypes

const std::string allNetMessageTypes[]
static

All known message types.

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

Definition at line 83 of file protocol.cpp.

Released under the MIT license