mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge #18764: refactor: test: replace inv type magic numbers by constants
4a614ff88atest: explicit imports from test_framework.messages in p2p_invalid_messages.py (Sebastian Falbesoner)b35e1d2471test: add inventory type constant MSG_CMPCT_BLOCK (Sebastian Falbesoner)eeaaa58d2ctest: replace inv type magic numbers by constants (Sebastian Falbesoner) Pull request description: Many functional tests still use magic numbers for inventory types, either passed to the `CInv` constructor or for comparing the `type` member of `CInv`. This PR replaces all of those by constants in the module `test_framework.messages` that have been introduced in commitc32cf9f622: `MSG_TX` (1) or `MSG_BLOCK` (2). It also introduces a new constant `MSG_CMPCT_BLOCK` (naming as in `src/protocol.h`) and uses it to replace the remaining magic numbers. The occurences of the magic numbers were identified through `grep`ing for `CInv(` and `type ==`. The idea was first to create a scripted-diff, but since also adding missing `import`s is needed, this would be non-trivial. Besides, also some unneeded comments like `# 2 == "Block"` could be removed. ACKs for top commit: gzhao408: ACK [`4a614ff`](4a614ff88a) Tree-SHA512: 4ba4fdef9f3eef7fd5ac72cb03ca3524863d1ae292161c550424a4c1047283fa2d2e7e03017d1fbae3652b3cb14f08b8d4b368403f3f209993aef3f2e2b22784
This commit is contained in:
@@ -54,6 +54,7 @@ NODE_NETWORK_LIMITED = (1 << 10)
|
||||
MSG_TX = 1
|
||||
MSG_BLOCK = 2
|
||||
MSG_FILTERED_BLOCK = 3
|
||||
MSG_CMPCT_BLOCK = 4
|
||||
MSG_WITNESS_FLAG = 1 << 30
|
||||
MSG_TYPE_MASK = 0xffffffff >> 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user