p2p: add CInv block message helper methods

pull/764/head
Jon Atack 4 years ago
parent 7f609f68d8
commit 471714e1f0
No known key found for this signature in database
GPG Key ID: 4F5721B3D0E3921D

@ -247,7 +247,7 @@ extern const char* CFCHECKPT;
* txid. * txid.
* @since protocol version 70016 as described by BIP 339. * @since protocol version 70016 as described by BIP 339.
*/ */
extern const char *WTXIDRELAY; extern const char* WTXIDRELAY;
}; // namespace NetMsgType }; // namespace NetMsgType
/* Get a vector of all valid message types (see above) */ /* Get a vector of all valid message types (see above) */
@ -418,12 +418,22 @@ public:
std::string ToString() const; std::string ToString() const;
// Single-message helper methods // Single-message helper methods
bool IsMsgTx() const { return type == MSG_TX; } bool IsMsgTx() const { return type == MSG_TX; }
bool IsMsgWtx() const { return type == MSG_WTX; } bool IsMsgBlk() const { return type == MSG_BLOCK; }
bool IsMsgWitnessTx() const { return type == MSG_WITNESS_TX; } bool IsMsgWtx() const { return type == MSG_WTX; }
bool IsMsgFilteredBlk() const { return type == MSG_FILTERED_BLOCK; }
bool IsMsgCmpctBlk() const { return type == MSG_CMPCT_BLOCK; }
bool IsMsgWitnessBlk() const { return type == MSG_WITNESS_BLOCK; }
// Combined-message helper methods // Combined-message helper methods
bool IsGenTxMsg() const { return type == MSG_TX || type == MSG_WTX || type == MSG_WITNESS_TX; } bool IsGenTxMsg() const
{
return type == MSG_TX || type == MSG_WTX || type == MSG_WITNESS_TX;
}
bool IsGenBlkMsg() const
{
return type == MSG_BLOCK || type == MSG_FILTERED_BLOCK || type == MSG_CMPCT_BLOCK || type == MSG_WITNESS_BLOCK;
}
int type; int type;
uint256 hash; uint256 hash;

Loading…
Cancel
Save