diff --git a/src/seeder/bitcoin.h b/src/seeder/bitcoin.h --- a/src/seeder/bitcoin.h +++ b/src/seeder/bitcoin.h @@ -19,9 +19,9 @@ // The network magic to use. extern CMessageHeader::MessageMagic netMagic; -enum PeerMessagingState : bool { - AwaitingMessages = false, - Finished = true, +enum class PeerMessagingState { + AwaitingMessages, + Finished, }; class CSeederNode { diff --git a/src/seeder/test/p2p_messaging_tests.cpp b/src/seeder/test/p2p_messaging_tests.cpp --- a/src/seeder/test/p2p_messaging_tests.cpp +++ b/src/seeder/test/p2p_messaging_tests.cpp @@ -8,12 +8,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -21,6 +23,11 @@ #include +std::ostream &operator<<(std::ostream &os, const PeerMessagingState &state) { + os << to_integral(state); + return os; +} + class TestCSeederNode : public CSeederNode { public: TestCSeederNode(const CService &service, std::vector *vAddrIn) diff --git a/src/seeder/test/util.h b/src/seeder/test/util.h new file mode 100644 --- /dev/null +++ b/src/seeder/test/util.h @@ -0,0 +1,15 @@ +// Copyright (c) 2020 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_SEEDER_TEST_UTIL_H +#define BITCOIN_SEEDER_TEST_UTIL_H + +#include + +template +constexpr typename std::underlying_type::type to_integral(E e) { + return static_cast::type>(e); +} + +#endif // BITCOIN_SEEDER_TEST_UTIL_H