aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/messages.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-05-20 15:06:37 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-05-20 15:11:51 -0400
commit3eda7ea9ba724bfa53ad6f4f63af85fccb46da00 (patch)
tree8396830aefc33a70bf7e48f8b8aee81f895ebe04 /test/functional/test_framework/messages.py
parent448bdff26307981b7e32ba5610dad6674c1fe46d (diff)
parent4a614ff88ac71d6457513a4f7aa8a3235874ff3f (diff)
downloadbitcoin-3eda7ea9ba724bfa53ad6f4f63af85fccb46da00.tar.xz
Merge #18764: refactor: test: replace inv type magic numbers by constants
4a614ff88ac71d6457513a4f7aa8a3235874ff3f test: explicit imports from test_framework.messages in p2p_invalid_messages.py (Sebastian Falbesoner) b35e1d2471c3d9e0b6cc4b94f4726a7e6ea32206 test: add inventory type constant MSG_CMPCT_BLOCK (Sebastian Falbesoner) eeaaa58d2ccc243a7506d34bca47c678867d6dd5 test: 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 commit c32cf9f62285b5cd18a5064aee91f0802f0f87a8: `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`](https://github.com/bitcoin/bitcoin/pull/18764/commits/4a614ff88ac71d6457513a4f7aa8a3235874ff3f) Tree-SHA512: 4ba4fdef9f3eef7fd5ac72cb03ca3524863d1ae292161c550424a4c1047283fa2d2e7e03017d1fbae3652b3cb14f08b8d4b368403f3f209993aef3f2e2b22784
Diffstat (limited to 'test/functional/test_framework/messages.py')
-rwxr-xr-xtest/functional/test_framework/messages.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index ef5ef49eaf..6c9c8a7397 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -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