File tree 2 files changed +8
-3
lines changed
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)
184
184
185
185
bool CInv::IsKnownType () const
186
186
{
187
- return (type >= 1 && type < (int )ARRAYLEN (ppszTypeName));
187
+ int masked = type & MSG_TYPE_MASK;
188
+ return (masked >= 1 && masked <= MSG_TYPE_MAX);
188
189
}
189
190
190
191
const char * CInv::GetCommand () const
Original file line number Diff line number Diff line change @@ -315,13 +315,17 @@ class CInv
315
315
uint256 hash;
316
316
};
317
317
318
+ const uint32_t MSG_WITNESS_FLAG = 1 << 30 ;
319
+ const uint32_t MSG_TYPE_MASK = 0xffffffff >> 2 ;
318
320
enum {
319
321
MSG_TX = 1 ,
320
322
MSG_BLOCK,
321
323
// The following can only occur in getdata. Invs always use TX or BLOCK.
322
324
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 ,
325
327
};
326
328
329
+ const int MSG_TYPE_MAX = MSG_FILTERED_BLOCK;
330
+
327
331
#endif // BITCOIN_PROTOCOL_H
You can’t perform that action at this time.
0 commit comments