Skip to content

Commit 471714e

Browse files
committed
p2p: add CInv block message helper methods
1 parent 7f609f6 commit 471714e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/protocol.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ extern const char* CFCHECKPT;
247247
* txid.
248248
* @since protocol version 70016 as described by BIP 339.
249249
*/
250-
extern const char *WTXIDRELAY;
250+
extern const char* WTXIDRELAY;
251251
}; // namespace NetMsgType
252252

253253
/* Get a vector of all valid message types (see above) */
@@ -418,12 +418,22 @@ class CInv
418418
std::string ToString() const;
419419

420420
// Single-message helper methods
421-
bool IsMsgTx() const { return type == MSG_TX; }
422-
bool IsMsgWtx() const { return type == MSG_WTX; }
423-
bool IsMsgWitnessTx() const { return type == MSG_WITNESS_TX; }
421+
bool IsMsgTx() const { return type == MSG_TX; }
422+
bool IsMsgBlk() const { return type == MSG_BLOCK; }
423+
bool IsMsgWtx() const { return type == MSG_WTX; }
424+
bool IsMsgFilteredBlk() const { return type == MSG_FILTERED_BLOCK; }
425+
bool IsMsgCmpctBlk() const { return type == MSG_CMPCT_BLOCK; }
426+
bool IsMsgWitnessBlk() const { return type == MSG_WITNESS_BLOCK; }
424427

425428
// Combined-message helper methods
426-
bool IsGenTxMsg() const { return type == MSG_TX || type == MSG_WTX || type == MSG_WITNESS_TX; }
429+
bool IsGenTxMsg() const
430+
{
431+
return type == MSG_TX || type == MSG_WTX || type == MSG_WITNESS_TX;
432+
}
433+
bool IsGenBlkMsg() const
434+
{
435+
return type == MSG_BLOCK || type == MSG_FILTERED_BLOCK || type == MSG_CMPCT_BLOCK || type == MSG_WITNESS_BLOCK;
436+
}
427437

428438
int type;
429439
uint256 hash;

0 commit comments

Comments
 (0)