File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,8 @@ bool operator<(const CInv& a, const CInv& b)
184184
185185bool CInv::IsKnownType () const
186186{
187- return (type >= 1 && type < (int )ARRAYLEN (ppszTypeName));
187+ int masked = type & MSG_TYPE_MASK;
188+ return (masked >= 1 && masked <= MSG_TYPE_MAX);
188189}
189190
190191const char * CInv::GetCommand () const
Original file line number Diff line number Diff line change @@ -315,13 +315,17 @@ class CInv
315315 uint256 hash;
316316};
317317
318+ const uint32_t MSG_WITNESS_FLAG = 1 << 30 ;
319+ const uint32_t MSG_TYPE_MASK = 0xffffffff >> 2 ;
318320enum {
319321 MSG_TX = 1 ,
320322 MSG_BLOCK,
321323 // The following can only occur in getdata. Invs always use TX or BLOCK.
322324 MSG_FILTERED_BLOCK,
323- MSG_WITNESS_BLOCK = MSG_BLOCK | 0x40000000 ,
324- MSG_WITNESS_TX = MSG_TX | 0x40000000 ,
325+ MSG_WITNESS_BLOCK = MSG_BLOCK | MSG_WITNESS_FLAG ,
326+ MSG_WITNESS_TX = MSG_TX | MSG_WITNESS_FLAG ,
325327};
326328
329+ const int MSG_TYPE_MAX = MSG_FILTERED_BLOCK;
330+
327331#endif // BITCOIN_PROTOCOL_H
You can’t perform that action at this time.
0 commit comments