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:
MarcoFalke 2020-05-20 07:27:49 -04:00 committed by PastaPastaPasta
parent 01adc81ebf
commit 0fa3aa65ca

View File

@ -66,17 +66,17 @@ namespace NetMsgType {
* The version message provides information about the transmitting node to the
* 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,
* 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
* network.
*/
extern const char *ADDR;
extern const char* ADDR;
/**
* 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
@ -93,70 +93,70 @@ extern const char *SENDADDRV2;
* The inv message (inventory message) transmits one or more inventories of
* 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.
*/
extern const char *GETDATA;
extern const char* GETDATA;
/**
* The merkleblock message is a reply to a getdata message which requested a
* block using the inventory type MSG_MERKLEBLOCK.
* @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
* 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
* headers starting from a particular point in the block chain.
* @since protocol version 31800.
*/
extern const char *GETHEADERS;
extern const char* GETHEADERS;
/**
* 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
* previously requested certain headers with a getheaders message.
* @since protocol version 31800.
*/
extern const char *HEADERS;
extern const char* HEADERS;
/**
* 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,
* 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
* node has verified as valid but which have not yet appeared in a block.
* @since protocol version 60002.
*/
extern const char *MEMPOOL;
extern const char* MEMPOOL;
/**
* The ping message is sent periodically to help confirm that the receiving
* 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 ponging node is still alive.
* @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
* object the receiving node does not have available for relay.
* @since protocol version 70001.
*/
extern const char *NOTFOUND;
extern const char* NOTFOUND;
/**
* The filterload message tells the receiving peer to filter all relayed
* 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
* 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
* 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
* 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
* bloom filter.
@ -180,13 +180,13 @@ extern const char *FILTERADD;
* Only available with service bit NODE_BLOOM since protocol version
* 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
* "headers" message rather than an "inv".
* @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.
@ -195,25 +195,25 @@ extern const char *SENDHEADERS;
* "cmpctblock" message rather than an "inv", depending on message contents.
* @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
* list of "short txids".
* @since protocol version 70209 as described by BIP 152
*/
extern const char *CMPCTBLOCK;
extern const char* CMPCTBLOCK;
/**
* Contains a BlockTransactionsRequest
* Peer should respond with "blocktxn" message.
* @since protocol version 70209 as described by BIP 152
*/
extern const char *GETBLOCKTXN;
extern const char* GETBLOCKTXN;
/**
* Contains a BlockTransactions.
* Sent in response to a "getblocktxn" message.
* @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.
* 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
* BIP 157 & 158.
*/
extern const char *GETCFCHECKPT;
extern const char* GETCFCHECKPT;
/**
* cfcheckpt is a response to a getcfcheckpt request containing a vector of
* evenly spaced filter headers for blocks on the requested chain.
*/
extern const char *CFCHECKPT;
extern const char* CFCHECKPT;
// Dash message types
// NOTE: do NOT declare non-implmented here, we don't want them to be exposed to the outside
// TODO: add description
extern const char *SPORK;
extern const char *GETSPORKS;
extern const char *DSACCEPT;
extern const char *DSVIN;
extern const char *DSFINALTX;
extern const char *DSSIGNFINALTX;
extern const char *DSCOMPLETE;
extern const char *DSSTATUSUPDATE;
extern const char *DSTX;
extern const char *DSQUEUE;
extern const char *SENDDSQUEUE;
extern const char *SYNCSTATUSCOUNT;
extern const char *MNGOVERNANCESYNC;
extern const char *MNGOVERNANCEOBJECT;
extern const char *MNGOVERNANCEOBJECTVOTE;
extern const char *GETMNLISTDIFF;
extern const char *MNLISTDIFF;
extern const char *QSENDRECSIGS;
extern const char *QFCOMMITMENT;
extern const char *QCONTRIB;
extern const char *QCOMPLAINT;
extern const char *QJUSTIFICATION;
extern const char *QPCOMMITMENT;
extern const char *QWATCH;
extern const char *QSIGSESANN;
extern const char *QSIGSHARESINV;
extern const char *QGETSIGSHARES;
extern const char *QBSIGSHARES;
extern const char *QSIGREC;
extern const char *QSIGSHARE;
extern const char* SPORK;
extern const char* GETSPORKS;
extern const char* DSACCEPT;
extern const char* DSVIN;
extern const char* DSFINALTX;
extern const char* DSSIGNFINALTX;
extern const char* DSCOMPLETE;
extern const char* DSSTATUSUPDATE;
extern const char* DSTX;
extern const char* DSQUEUE;
extern const char* SENDDSQUEUE;
extern const char* SYNCSTATUSCOUNT;
extern const char* MNGOVERNANCESYNC;
extern const char* MNGOVERNANCEOBJECT;
extern const char* MNGOVERNANCEOBJECTVOTE;
extern const char* GETMNLISTDIFF;
extern const char* MNLISTDIFF;
extern const char* QSENDRECSIGS;
extern const char* QFCOMMITMENT;
extern const char* QCONTRIB;
extern const char* QCOMPLAINT;
extern const char* QJUSTIFICATION;
extern const char* QPCOMMITMENT;
extern const char* QWATCH;
extern const char* QSIGSESANN;
extern const char* QSIGSHARESINV;
extern const char* QGETSIGSHARES;
extern const char* QBSIGSHARES;
extern const char* QSIGREC;
extern const char* QSIGSHARE;
extern const char* QGETDATA;
extern const char* QDATA;
extern const char *CLSIG;
extern const char *ISLOCK;
extern const char *ISDLOCK;
extern const char *MNAUTH;
extern const char *GETHEADERS2;
extern const char *SENDHEADERS2;
extern const char *HEADERS2;
extern const char *GETQUORUMROTATIONINFO;
extern const char *QUORUMROTATIONINFO;
extern const char* CLSIG;
extern const char* ISLOCK;
extern const char* ISDLOCK;
extern const char* MNAUTH;
extern const char* GETHEADERS2;
extern const char* SENDHEADERS2;
extern const char* HEADERS2;
extern const char* GETQUORUMROTATIONINFO;
extern const char* QUORUMROTATIONINFO;
};
/* 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 */
bool NetMessageViolatesBlocksOnly(const std::string& msg_type);
@ -375,7 +375,8 @@ void SetServiceFlagsIBDCache(bool status);
* == GetDesirableServiceFlags(services), ie determines whether the given
* 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));
}
@ -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
* robust address-storage DB.
*/
static inline bool MayHaveUsefulAddressDB(ServiceFlags services) {
static inline bool MayHaveUsefulAddressDB(ServiceFlags services)
{
return (services & NODE_NETWORK) || (services & NODE_NETWORK_LIMITED);
}