From 85a87aa679465994a976148f1c144e69859fe919 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 4 Oct 2016 17:55:12 +0200 Subject: [PATCH] protocol.h: Make enums in GetDataMsg concrete values This concretizes the numbers and adds a comment to make it clear that these numbers are fixed by the protocol, and may avoid people forgetting to claim numbers in the future (e.g. issue #8500). Also gets rid of a weird unused `MSG_TYPE_MAX` in the middle of the enumeration (thanks @paveljanik for noticing). (cherry picked from commit bitcoin/bitcoin@1df311118d79c04df1d41e044b19444cfda015da) --- src/protocol.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/protocol.h b/src/protocol.h index 59fee7f4e44..fd6be31053c 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -116,15 +116,18 @@ class CAddress : public CService unsigned int nTime; }; -/** getdata message types */ +/** getdata / inv message types. + * These numbers are defined by the protocol. When adding a new value, be sure + * to mention it in the respective ZIP, as well as checking for collisions with + * BIPs we might want to backport. + */ enum GetDataMsg { UNDEFINED = 0, - MSG_TX, - MSG_BLOCK, - MSG_TYPE_MAX = MSG_BLOCK, + MSG_TX = 1, + MSG_BLOCK = 2, // The following can only occur in getdata. Invs always use TX or BLOCK. - MSG_FILTERED_BLOCK, + MSG_FILTERED_BLOCK = 3, //!< Defined in BIP37 }; /** inv message data */