Merge #18996: net: Remove un-actionable TODO

fabea6d404 net: Run clang-format on protocol.h (MarcoFalke)
facdeea2b2 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 fabea6d404
  naumenkogs:
    ACK fabea6d. Not sure why that TODO was there in the first place, but Marco's justification seems correct.
  hebasto:
    ACK fabea6d404, agree with both changes: removing TODO and applying the `clang-format-diff.py`.

Tree-SHA512: b79ae07be27e5a40fc9f411a5e9ae91aecb2fdedbcbf74699614a1004f4ef816bf396903ec6c06eb1395fd83a2047620c7583acbaadfb8c4e613319a63062c3c
This commit is contained in:
MarcoFalke committed 2020-05-20 07:27:53 -04:00
commit e20e964cb1
1 file changed
+6 -8
+6 -8
View File
@@ -248,7 +248,7 @@ extern const char *GETCFCHECKPT;
* BIP 157 & 158. * BIP 157 & 158.
*/ */
extern const char* CFCHECKPT; extern const char* CFCHECKPT;
}; }; // namespace NetMsgType
/* 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();
@@ -320,7 +320,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));
} }
@@ -328,7 +329,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);
} }
@@ -360,8 +362,6 @@ public:
READWRITEAS(CService, *this); READWRITEAS(CService, *this);
} }
// TODO: make private (improves encapsulation)
public:
ServiceFlags nServices; ServiceFlags nServices;
// disk and network only // disk and network only
@@ -376,8 +376,7 @@ const uint32_t MSG_TYPE_MASK = 0xffffffff >> 2;
* These numbers are defined by the protocol. When adding a new value, be sure * These numbers are defined by the protocol. When adding a new value, be sure
* to mention it in the respective BIP. * to mention it in the respective BIP.
*/ */
enum GetDataMsg enum GetDataMsg {
{
UNDEFINED = 0, UNDEFINED = 0,
MSG_TX = 1, MSG_TX = 1,
MSG_BLOCK = 2, MSG_BLOCK = 2,
@@ -410,7 +409,6 @@ public:
std::string GetCommand() const; std::string GetCommand() const;
std::string ToString() const; std::string ToString() const;
public:
int type; int type;
uint256 hash; uint256 hash;
}; };