Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

protocol.h File Reference
#include <netaddress.h>
#include <serialize.h>
#include <uint256.h>
#include <version.h>
#include <atomic>
#include <stdint.h>
#include <string>
+ Include dependency graph for protocol.h:
+ This graph shows which files directly or indirectly include this file:

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_GETUTXO = (1 << 1), NODE_BLOOM = (1 << 2),
  NODE_XTHIN = (1 << 4), NODE_NETWORK_LIMITED = (1 << 10)
}
 nServices flags More...
 
enum  GetDataMsg {
  UNDEFINED = 0, MSG_TX = 1, MSG_BLOCK = 2, MSG_FILTERED_BLOCK = 3,
  MSG_LEGACY_TXLOCK_REQUEST = 4, MSG_SPORK = 6, MSG_DSTX = 16, MSG_GOVERNANCE_OBJECT = 17,
  MSG_GOVERNANCE_OBJECT_VOTE = 18, MSG_CMPCT_BLOCK = 20, MSG_QUORUM_FINAL_COMMITMENT = 21, MSG_QUORUM_CONTRIB = 23,
  MSG_QUORUM_COMPLAINT = 24, MSG_QUORUM_JUSTIFICATION = 25, MSG_QUORUM_PREMATURE_COMMITMENT = 26, MSG_QUORUM_RECOVERED_SIG = 28,
  MSG_CLSIG = 29, MSG_ISLOCK = 30
}
 getdata / inv message types. More...
 

Functions

const std::vector< std::string > & getAllNetMessageTypes ()
 
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...
 

Enumeration Type Documentation

◆ GetDataMsg

enum GetDataMsg

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.

Enumerator
UNDEFINED 
MSG_TX 
MSG_BLOCK 
MSG_FILTERED_BLOCK 

Defined in BIP37.

MSG_LEGACY_TXLOCK_REQUEST 
MSG_SPORK 
MSG_DSTX 
MSG_GOVERNANCE_OBJECT 
MSG_GOVERNANCE_OBJECT_VOTE 
MSG_CMPCT_BLOCK 

Defined in BIP152.

MSG_QUORUM_FINAL_COMMITMENT 
MSG_QUORUM_CONTRIB 
MSG_QUORUM_COMPLAINT 
MSG_QUORUM_JUSTIFICATION 
MSG_QUORUM_PREMATURE_COMMITMENT 
MSG_QUORUM_RECOVERED_SIG 
MSG_CLSIG 
MSG_ISLOCK 

Definition at line 397 of file protocol.h.

◆ ServiceFlags

enum ServiceFlags : uint64_t

nServices flags

Enumerator
NODE_NONE 
NODE_NETWORK 
NODE_GETUTXO 
NODE_BLOOM 
NODE_XTHIN 
NODE_NETWORK_LIMITED 

Definition at line 280 of file protocol.h.

Function Documentation

◆ 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().

◆ HasAllDesirableServiceFlags()

static bool HasAllDesirableServiceFlags ( ServiceFlags  services)
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.

References GetDesirableServiceFlags().

Referenced by CConnman::AttemptToEvictConnection(), ProcessMessage(), and CConnman::ThreadOpenConnections().

◆ MayHaveUsefulAddressDB()

static bool MayHaveUsefulAddressDB ( ServiceFlags  services)
inlinestatic

Checks if a peer with the given service flags may be capable of having a robust address-storage DB.

Definition at line 353 of file protocol.h.

References NODE_NETWORK, and NODE_NETWORK_LIMITED.

Referenced by ProcessMessage(), and CConnman::ThreadOpenConnections().

◆ SetServiceFlagsIBDCache()

void SetServiceFlagsIBDCache ( bool  status)

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().

Released under the MIT license