diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-06-13 19:30:04 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-06-13 19:34:17 +0200 |
commit | be9711e597071c813bdd72c2866c547f117e4865 (patch) | |
tree | f965abcecc43584d8f9f9a42629df169fdcc249e /src/protocol.h | |
parent | 44c1b1c9bb54082625c7ad76af25473abf79f866 (diff) | |
parent | ecd7fd37c888f8ebc64cf3d92272975b37ae54ca (diff) | |
download | bitcoin-be9711e597071c813bdd72c2866c547f117e4865.tar.xz |
Merge #7749: Enforce expected outbound services
ecd7fd3 Introduce REQUIRED_SERVICES constant (Pieter Wuille)
ee06e04 Introduce enum ServiceFlags for service flags (Pieter Wuille)
15bf863 Don't require services in -addnode (Pieter Wuille)
5e7ab16 Only store and connect to NODE_NETWORK nodes (Pieter Wuille)
fc83f18 Verify that outbound connections have expected services (Pieter Wuille)
3764dec Keep addrman's nService bits consistent with outbound observations (Pieter Wuille)
Diffstat (limited to 'src/protocol.h')
-rw-r--r-- | src/protocol.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/protocol.h b/src/protocol.h index 1b049e52af..ab0a581783 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -223,7 +223,9 @@ extern const char *FEEFILTER; const std::vector<std::string> &getAllNetMessageTypes(); /** nServices flags */ -enum { +enum ServiceFlags : uint64_t { + // Nothing + NODE_NONE = 0, // NODE_NETWORK means that the node is capable of serving the block chain. It is currently // set by all Bitcoin Core nodes, and is unset by SPV clients or other peers that just want // network services but don't provide them. @@ -251,7 +253,7 @@ class CAddress : public CService { public: CAddress(); - explicit CAddress(CService ipIn, uint64_t nServicesIn = NODE_NETWORK); + explicit CAddress(CService ipIn, ServiceFlags nServicesIn); void Init(); @@ -267,13 +269,15 @@ public: if ((nType & SER_DISK) || (nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH))) READWRITE(nTime); - READWRITE(nServices); + uint64_t nServicesInt = nServices; + READWRITE(nServicesInt); + nServices = (ServiceFlags)nServicesInt; READWRITE(*(CService*)this); } // TODO: make private (improves encapsulation) public: - uint64_t nServices; + ServiceFlags nServices; // disk and network only unsigned int nTime; |