mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge #18996: net: Remove un-actionable TODO
fabea6d404571d046365f4f083da3569d2cbf4f7 net: Run clang-format on protocol.h (MarcoFalke) facdeea2b25ef36e37b6ada58ea390a72d11a4b2 net: Remove un-actionable TODO (MarcoFalke) Pull request description: The first commit removes a TODO that is infeasible to solve. Currently, most (de)serializable classes in Bitcoin Core have public members. For example `CMessageHeader`, `FlatFilePos`, `CBlock`, `CTransaction`, `CCoin`, ... So either this TODO comment should apply to all classes or to none. Fix that discrepancy by removing it from the source code for now. If deemed important, the TODO can be discussed in a brainstorming issue later. Also run clang format on the header file in a new commit. Happy to drop this commit if it is too controversial, but I think it is trivial to review and makes the workflow of developers using clang-format-diff easier. ACKs for top commit: practicalswift: ACK fabea6d404571d046365f4f083da3569d2cbf4f7 naumenkogs: ACK fabea6d. Not sure why that TODO was there in the first place, but Marco's justification seems correct. hebasto: ACK fabea6d404571d046365f4f083da3569d2cbf4f7, agree with both changes: removing TODO and applying the `clang-format-diff.py`. Tree-SHA512: b79ae07be27e5a40fc9f411a5e9ae91aecb2fdedbcbf74699614a1004f4ef816bf396903ec6c06eb1395fd83a2047620c7583acbaadfb8c4e613319a63062c3c
This commit is contained in:
parent
01adc81ebf
commit
0fa3aa65ca
150
src/protocol.h
150
src/protocol.h
@ -66,17 +66,17 @@ namespace NetMsgType {
|
|||||||
* The version message provides information about the transmitting node to the
|
* The version message provides information about the transmitting node to the
|
||||||
* receiving node at the beginning of a connection.
|
* receiving node at the beginning of a connection.
|
||||||
*/
|
*/
|
||||||
extern const char *VERSION;
|
extern const char* VERSION;
|
||||||
/**
|
/**
|
||||||
* The verack message acknowledges a previously-received version message,
|
* The verack message acknowledges a previously-received version message,
|
||||||
* informing the connecting node that it can begin to send other messages.
|
* informing the connecting node that it can begin to send other messages.
|
||||||
*/
|
*/
|
||||||
extern const char *VERACK;
|
extern const char* VERACK;
|
||||||
/**
|
/**
|
||||||
* The addr (IP address) message relays connection information for peers on the
|
* The addr (IP address) message relays connection information for peers on the
|
||||||
* network.
|
* network.
|
||||||
*/
|
*/
|
||||||
extern const char *ADDR;
|
extern const char* ADDR;
|
||||||
/**
|
/**
|
||||||
* The addrv2 message relays connection information for peers on the network just
|
* 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
|
* like the addr message, but is extended to allow gossiping of longer node
|
||||||
@ -93,70 +93,70 @@ extern const char *SENDADDRV2;
|
|||||||
* The inv message (inventory message) transmits one or more inventories of
|
* The inv message (inventory message) transmits one or more inventories of
|
||||||
* objects known to the transmitting peer.
|
* objects known to the transmitting peer.
|
||||||
*/
|
*/
|
||||||
extern const char *INV;
|
extern const char* INV;
|
||||||
/**
|
/**
|
||||||
* The getdata message requests one or more data objects from another node.
|
* The getdata message requests one or more data objects from another node.
|
||||||
*/
|
*/
|
||||||
extern const char *GETDATA;
|
extern const char* GETDATA;
|
||||||
/**
|
/**
|
||||||
* The merkleblock message is a reply to a getdata message which requested a
|
* The merkleblock message is a reply to a getdata message which requested a
|
||||||
* block using the inventory type MSG_MERKLEBLOCK.
|
* block using the inventory type MSG_MERKLEBLOCK.
|
||||||
* @since protocol version 70001 as described by BIP37.
|
* @since protocol version 70001 as described by BIP37.
|
||||||
*/
|
*/
|
||||||
extern const char *MERKLEBLOCK;
|
extern const char* MERKLEBLOCK;
|
||||||
/**
|
/**
|
||||||
* The getblocks message requests an inv message that provides block header
|
* The getblocks message requests an inv message that provides block header
|
||||||
* hashes starting from a particular point in the block chain.
|
* hashes starting from a particular point in the block chain.
|
||||||
*/
|
*/
|
||||||
extern const char *GETBLOCKS;
|
extern const char* GETBLOCKS;
|
||||||
/**
|
/**
|
||||||
* The getheaders message requests a headers message that provides block
|
* The getheaders message requests a headers message that provides block
|
||||||
* headers starting from a particular point in the block chain.
|
* headers starting from a particular point in the block chain.
|
||||||
* @since protocol version 31800.
|
* @since protocol version 31800.
|
||||||
*/
|
*/
|
||||||
extern const char *GETHEADERS;
|
extern const char* GETHEADERS;
|
||||||
/**
|
/**
|
||||||
* The tx message transmits a single transaction.
|
* The tx message transmits a single transaction.
|
||||||
*/
|
*/
|
||||||
extern const char *TX;
|
extern const char* TX;
|
||||||
/**
|
/**
|
||||||
* The headers message sends one or more block headers to a node which
|
* The headers message sends one or more block headers to a node which
|
||||||
* previously requested certain headers with a getheaders message.
|
* previously requested certain headers with a getheaders message.
|
||||||
* @since protocol version 31800.
|
* @since protocol version 31800.
|
||||||
*/
|
*/
|
||||||
extern const char *HEADERS;
|
extern const char* HEADERS;
|
||||||
/**
|
/**
|
||||||
* The block message transmits a single serialized block.
|
* The block message transmits a single serialized block.
|
||||||
*/
|
*/
|
||||||
extern const char *BLOCK;
|
extern const char* BLOCK;
|
||||||
/**
|
/**
|
||||||
* The getaddr message requests an addr message from the receiving node,
|
* The getaddr message requests an addr message from the receiving node,
|
||||||
* preferably one with lots of IP addresses of other receiving nodes.
|
* preferably one with lots of IP addresses of other receiving nodes.
|
||||||
*/
|
*/
|
||||||
extern const char *GETADDR;
|
extern const char* GETADDR;
|
||||||
/**
|
/**
|
||||||
* The mempool message requests the TXIDs of transactions that the receiving
|
* 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.
|
* node has verified as valid but which have not yet appeared in a block.
|
||||||
* @since protocol version 60002.
|
* @since protocol version 60002.
|
||||||
*/
|
*/
|
||||||
extern const char *MEMPOOL;
|
extern const char* MEMPOOL;
|
||||||
/**
|
/**
|
||||||
* The ping message is sent periodically to help confirm that the receiving
|
* The ping message is sent periodically to help confirm that the receiving
|
||||||
* peer is still connected.
|
* peer is still connected.
|
||||||
*/
|
*/
|
||||||
extern const char *PING;
|
extern const char* PING;
|
||||||
/**
|
/**
|
||||||
* The pong message replies to a ping message, proving to the pinging node that
|
* The pong message replies to a ping message, proving to the pinging node that
|
||||||
* the ponging node is still alive.
|
* the ponging node is still alive.
|
||||||
* @since protocol version 60001 as described by BIP31.
|
* @since protocol version 60001 as described by BIP31.
|
||||||
*/
|
*/
|
||||||
extern const char *PONG;
|
extern const char* PONG;
|
||||||
/**
|
/**
|
||||||
* The notfound message is a reply to a getdata message which requested an
|
* The notfound message is a reply to a getdata message which requested an
|
||||||
* object the receiving node does not have available for relay.
|
* object the receiving node does not have available for relay.
|
||||||
* @since protocol version 70001.
|
* @since protocol version 70001.
|
||||||
*/
|
*/
|
||||||
extern const char *NOTFOUND;
|
extern const char* NOTFOUND;
|
||||||
/**
|
/**
|
||||||
* The filterload message tells the receiving peer to filter all relayed
|
* The filterload message tells the receiving peer to filter all relayed
|
||||||
* transactions and requested merkle blocks through the provided filter.
|
* transactions and requested merkle blocks through the provided filter.
|
||||||
@ -164,7 +164,7 @@ extern const char *NOTFOUND;
|
|||||||
* Only available with service bit NODE_BLOOM since protocol version
|
* Only available with service bit NODE_BLOOM since protocol version
|
||||||
* 70011 as described by BIP111.
|
* 70011 as described by BIP111.
|
||||||
*/
|
*/
|
||||||
extern const char *FILTERLOAD;
|
extern const char* FILTERLOAD;
|
||||||
/**
|
/**
|
||||||
* The filteradd message tells the receiving peer to add a single element to a
|
* The filteradd message tells the receiving peer to add a single element to a
|
||||||
* previously-set bloom filter, such as a new public key.
|
* previously-set bloom filter, such as a new public key.
|
||||||
@ -172,7 +172,7 @@ extern const char *FILTERLOAD;
|
|||||||
* Only available with service bit NODE_BLOOM since protocol version
|
* Only available with service bit NODE_BLOOM since protocol version
|
||||||
* 70011 as described by BIP111.
|
* 70011 as described by BIP111.
|
||||||
*/
|
*/
|
||||||
extern const char *FILTERADD;
|
extern const char* FILTERADD;
|
||||||
/**
|
/**
|
||||||
* The filterclear message tells the receiving peer to remove a previously-set
|
* The filterclear message tells the receiving peer to remove a previously-set
|
||||||
* bloom filter.
|
* bloom filter.
|
||||||
@ -180,13 +180,13 @@ extern const char *FILTERADD;
|
|||||||
* Only available with service bit NODE_BLOOM since protocol version
|
* Only available with service bit NODE_BLOOM since protocol version
|
||||||
* 70011 as described by BIP111.
|
* 70011 as described by BIP111.
|
||||||
*/
|
*/
|
||||||
extern const char *FILTERCLEAR;
|
extern const char* FILTERCLEAR;
|
||||||
/**
|
/**
|
||||||
* Indicates that a node prefers to receive new block announcements via a
|
* Indicates that a node prefers to receive new block announcements via a
|
||||||
* "headers" message rather than an "inv".
|
* "headers" message rather than an "inv".
|
||||||
* @since protocol version 70012 as described by BIP130.
|
* @since protocol version 70012 as described by BIP130.
|
||||||
*/
|
*/
|
||||||
extern const char *SENDHEADERS;
|
extern const char* SENDHEADERS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a 1-byte bool and 8-byte LE version number.
|
* Contains a 1-byte bool and 8-byte LE version number.
|
||||||
@ -195,25 +195,25 @@ extern const char *SENDHEADERS;
|
|||||||
* "cmpctblock" message rather than an "inv", depending on message contents.
|
* "cmpctblock" message rather than an "inv", depending on message contents.
|
||||||
* @since protocol version 70209 as described by BIP 152
|
* @since protocol version 70209 as described by BIP 152
|
||||||
*/
|
*/
|
||||||
extern const char *SENDCMPCT;
|
extern const char* SENDCMPCT;
|
||||||
/**
|
/**
|
||||||
* Contains a CBlockHeaderAndShortTxIDs object - providing a header and
|
* Contains a CBlockHeaderAndShortTxIDs object - providing a header and
|
||||||
* list of "short txids".
|
* list of "short txids".
|
||||||
* @since protocol version 70209 as described by BIP 152
|
* @since protocol version 70209 as described by BIP 152
|
||||||
*/
|
*/
|
||||||
extern const char *CMPCTBLOCK;
|
extern const char* CMPCTBLOCK;
|
||||||
/**
|
/**
|
||||||
* Contains a BlockTransactionsRequest
|
* Contains a BlockTransactionsRequest
|
||||||
* Peer should respond with "blocktxn" message.
|
* Peer should respond with "blocktxn" message.
|
||||||
* @since protocol version 70209 as described by BIP 152
|
* @since protocol version 70209 as described by BIP 152
|
||||||
*/
|
*/
|
||||||
extern const char *GETBLOCKTXN;
|
extern const char* GETBLOCKTXN;
|
||||||
/**
|
/**
|
||||||
* Contains a BlockTransactions.
|
* Contains a BlockTransactions.
|
||||||
* Sent in response to a "getblocktxn" message.
|
* Sent in response to a "getblocktxn" message.
|
||||||
* @since protocol version 70209 as described by BIP 152
|
* @since protocol version 70209 as described by BIP 152
|
||||||
*/
|
*/
|
||||||
extern const char *BLOCKTXN;
|
extern const char* BLOCKTXN;
|
||||||
/**
|
/**
|
||||||
* getcfilters requests compact filters for a range of blocks.
|
* getcfilters requests compact filters for a range of blocks.
|
||||||
* Only available with service bit NODE_COMPACT_FILTERS as described by
|
* Only available with service bit NODE_COMPACT_FILTERS as described by
|
||||||
@ -244,61 +244,61 @@ extern const char* CFHEADERS;
|
|||||||
* Only available with service bit NODE_COMPACT_FILTERS as described by
|
* Only available with service bit NODE_COMPACT_FILTERS as described by
|
||||||
* BIP 157 & 158.
|
* BIP 157 & 158.
|
||||||
*/
|
*/
|
||||||
extern const char *GETCFCHECKPT;
|
extern const char* GETCFCHECKPT;
|
||||||
/**
|
/**
|
||||||
* cfcheckpt is a response to a getcfcheckpt request containing a vector of
|
* cfcheckpt is a response to a getcfcheckpt request containing a vector of
|
||||||
* evenly spaced filter headers for blocks on the requested chain.
|
* evenly spaced filter headers for blocks on the requested chain.
|
||||||
*/
|
*/
|
||||||
extern const char *CFCHECKPT;
|
extern const char* CFCHECKPT;
|
||||||
|
|
||||||
// Dash message types
|
// Dash message types
|
||||||
// NOTE: do NOT declare non-implmented here, we don't want them to be exposed to the outside
|
// NOTE: do NOT declare non-implmented here, we don't want them to be exposed to the outside
|
||||||
// TODO: add description
|
// TODO: add description
|
||||||
extern const char *SPORK;
|
extern const char* SPORK;
|
||||||
extern const char *GETSPORKS;
|
extern const char* GETSPORKS;
|
||||||
extern const char *DSACCEPT;
|
extern const char* DSACCEPT;
|
||||||
extern const char *DSVIN;
|
extern const char* DSVIN;
|
||||||
extern const char *DSFINALTX;
|
extern const char* DSFINALTX;
|
||||||
extern const char *DSSIGNFINALTX;
|
extern const char* DSSIGNFINALTX;
|
||||||
extern const char *DSCOMPLETE;
|
extern const char* DSCOMPLETE;
|
||||||
extern const char *DSSTATUSUPDATE;
|
extern const char* DSSTATUSUPDATE;
|
||||||
extern const char *DSTX;
|
extern const char* DSTX;
|
||||||
extern const char *DSQUEUE;
|
extern const char* DSQUEUE;
|
||||||
extern const char *SENDDSQUEUE;
|
extern const char* SENDDSQUEUE;
|
||||||
extern const char *SYNCSTATUSCOUNT;
|
extern const char* SYNCSTATUSCOUNT;
|
||||||
extern const char *MNGOVERNANCESYNC;
|
extern const char* MNGOVERNANCESYNC;
|
||||||
extern const char *MNGOVERNANCEOBJECT;
|
extern const char* MNGOVERNANCEOBJECT;
|
||||||
extern const char *MNGOVERNANCEOBJECTVOTE;
|
extern const char* MNGOVERNANCEOBJECTVOTE;
|
||||||
extern const char *GETMNLISTDIFF;
|
extern const char* GETMNLISTDIFF;
|
||||||
extern const char *MNLISTDIFF;
|
extern const char* MNLISTDIFF;
|
||||||
extern const char *QSENDRECSIGS;
|
extern const char* QSENDRECSIGS;
|
||||||
extern const char *QFCOMMITMENT;
|
extern const char* QFCOMMITMENT;
|
||||||
extern const char *QCONTRIB;
|
extern const char* QCONTRIB;
|
||||||
extern const char *QCOMPLAINT;
|
extern const char* QCOMPLAINT;
|
||||||
extern const char *QJUSTIFICATION;
|
extern const char* QJUSTIFICATION;
|
||||||
extern const char *QPCOMMITMENT;
|
extern const char* QPCOMMITMENT;
|
||||||
extern const char *QWATCH;
|
extern const char* QWATCH;
|
||||||
extern const char *QSIGSESANN;
|
extern const char* QSIGSESANN;
|
||||||
extern const char *QSIGSHARESINV;
|
extern const char* QSIGSHARESINV;
|
||||||
extern const char *QGETSIGSHARES;
|
extern const char* QGETSIGSHARES;
|
||||||
extern const char *QBSIGSHARES;
|
extern const char* QBSIGSHARES;
|
||||||
extern const char *QSIGREC;
|
extern const char* QSIGREC;
|
||||||
extern const char *QSIGSHARE;
|
extern const char* QSIGSHARE;
|
||||||
extern const char* QGETDATA;
|
extern const char* QGETDATA;
|
||||||
extern const char* QDATA;
|
extern const char* QDATA;
|
||||||
extern const char *CLSIG;
|
extern const char* CLSIG;
|
||||||
extern const char *ISLOCK;
|
extern const char* ISLOCK;
|
||||||
extern const char *ISDLOCK;
|
extern const char* ISDLOCK;
|
||||||
extern const char *MNAUTH;
|
extern const char* MNAUTH;
|
||||||
extern const char *GETHEADERS2;
|
extern const char* GETHEADERS2;
|
||||||
extern const char *SENDHEADERS2;
|
extern const char* SENDHEADERS2;
|
||||||
extern const char *HEADERS2;
|
extern const char* HEADERS2;
|
||||||
extern const char *GETQUORUMROTATIONINFO;
|
extern const char* GETQUORUMROTATIONINFO;
|
||||||
extern const char *QUORUMROTATIONINFO;
|
extern const char* QUORUMROTATIONINFO;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get a vector of all valid message types (see above) */
|
/* Get a vector of all valid message types (see above) */
|
||||||
const std::vector<std::string> &getAllNetMessageTypes();
|
const std::vector<std::string>& getAllNetMessageTypes();
|
||||||
|
|
||||||
/* Whether the message type violates blocks-relay-only policy */
|
/* Whether the message type violates blocks-relay-only policy */
|
||||||
bool NetMessageViolatesBlocksOnly(const std::string& msg_type);
|
bool NetMessageViolatesBlocksOnly(const std::string& msg_type);
|
||||||
@ -375,7 +375,8 @@ void SetServiceFlagsIBDCache(bool status);
|
|||||||
* == GetDesirableServiceFlags(services), ie determines whether the given
|
* == GetDesirableServiceFlags(services), ie determines whether the given
|
||||||
* set of service flags are sufficient for a peer to be "relevant".
|
* set of service flags are sufficient for a peer to be "relevant".
|
||||||
*/
|
*/
|
||||||
static inline bool HasAllDesirableServiceFlags(ServiceFlags services) {
|
static inline bool HasAllDesirableServiceFlags(ServiceFlags services)
|
||||||
|
{
|
||||||
return !(GetDesirableServiceFlags(services) & (~services));
|
return !(GetDesirableServiceFlags(services) & (~services));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +384,8 @@ static inline bool HasAllDesirableServiceFlags(ServiceFlags services) {
|
|||||||
* Checks if a peer with the given service flags may be capable of having a
|
* Checks if a peer with the given service flags may be capable of having a
|
||||||
* robust address-storage DB.
|
* robust address-storage DB.
|
||||||
*/
|
*/
|
||||||
static inline bool MayHaveUsefulAddressDB(ServiceFlags services) {
|
static inline bool MayHaveUsefulAddressDB(ServiceFlags services)
|
||||||
|
{
|
||||||
return (services & NODE_NETWORK) || (services & NODE_NETWORK_LIMITED);
|
return (services & NODE_NETWORK) || (services & NODE_NETWORK_LIMITED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,11 +502,11 @@ enum GetDataMsg {
|
|||||||
MSG_TX = 1,
|
MSG_TX = 1,
|
||||||
MSG_BLOCK = 2,
|
MSG_BLOCK = 2,
|
||||||
// The following can only occur in getdata. Invs always use TX or BLOCK.
|
// The following can only occur in getdata. Invs always use TX or BLOCK.
|
||||||
MSG_FILTERED_BLOCK = 3, //!< Defined in BIP37
|
MSG_FILTERED_BLOCK = 3, //!< Defined in BIP37
|
||||||
// Dash message types
|
// Dash message types
|
||||||
// NOTE: we must keep this enum consistent and backwards compatible
|
// NOTE: we must keep this enum consistent and backwards compatible
|
||||||
/* MSG_LEGACY_TXLOCK_REQUEST = 4, */ // Legacy InstantSend and not used anymore
|
/* MSG_LEGACY_TXLOCK_REQUEST = 4, */ // Legacy InstantSend and not used anymore
|
||||||
/* MSG_TXLOCK_VOTE = 5, */ // Legacy InstantSend and not used anymore
|
/* MSG_TXLOCK_VOTE = 5, */ // Legacy InstantSend and not used anymore
|
||||||
MSG_SPORK = 6,
|
MSG_SPORK = 6,
|
||||||
/* 7 - 15 were used in old Dash versions and were mainly budget and MN broadcast/ping related*/
|
/* 7 - 15 were used in old Dash versions and were mainly budget and MN broadcast/ping related*/
|
||||||
MSG_DSTX = 16,
|
MSG_DSTX = 16,
|
||||||
@ -513,14 +515,14 @@ enum GetDataMsg {
|
|||||||
/* 19 was used for MSG_MASTERNODE_VERIFY and is not supported anymore */
|
/* 19 was used for MSG_MASTERNODE_VERIFY and is not supported anymore */
|
||||||
// Nodes may always request a MSG_CMPCT_BLOCK in a getdata, however,
|
// Nodes may always request a MSG_CMPCT_BLOCK in a getdata, however,
|
||||||
// MSG_CMPCT_BLOCK should not appear in any invs except as a part of getdata.
|
// MSG_CMPCT_BLOCK should not appear in any invs except as a part of getdata.
|
||||||
MSG_CMPCT_BLOCK = 20, //!< Defined in BIP152
|
MSG_CMPCT_BLOCK = 20, //!< Defined in BIP152
|
||||||
MSG_QUORUM_FINAL_COMMITMENT = 21,
|
MSG_QUORUM_FINAL_COMMITMENT = 21,
|
||||||
/* MSG_QUORUM_DUMMY_COMMITMENT = 22, */ // was shortly used on testnet/devnet/regtest
|
/* MSG_QUORUM_DUMMY_COMMITMENT = 22, */ // was shortly used on testnet/devnet/regtest
|
||||||
MSG_QUORUM_CONTRIB = 23,
|
MSG_QUORUM_CONTRIB = 23,
|
||||||
MSG_QUORUM_COMPLAINT = 24,
|
MSG_QUORUM_COMPLAINT = 24,
|
||||||
MSG_QUORUM_JUSTIFICATION = 25,
|
MSG_QUORUM_JUSTIFICATION = 25,
|
||||||
MSG_QUORUM_PREMATURE_COMMITMENT = 26,
|
MSG_QUORUM_PREMATURE_COMMITMENT = 26,
|
||||||
/* MSG_QUORUM_DEBUG_STATUS = 27, */ // was shortly used on testnet/devnet/regtest
|
/* MSG_QUORUM_DEBUG_STATUS = 27, */ // was shortly used on testnet/devnet/regtest
|
||||||
MSG_QUORUM_RECOVERED_SIG = 28,
|
MSG_QUORUM_RECOVERED_SIG = 28,
|
||||||
MSG_CLSIG = 29,
|
MSG_CLSIG = 29,
|
||||||
MSG_ISLOCK = 30,
|
MSG_ISLOCK = 30,
|
||||||
|
Loading…
Reference in New Issue
Block a user