12#include <boost/test/unit_test.hpp>
17BOOST_AUTO_TEST_SUITE(message_writer_tests)
19template <
typename... Args>
25 for (
size_t i = 0; i < message.
size(); i++) {
38 std::string user_agent =
"/Bitcoin ABC:0.0.0(seeder)/";
43 << addrFrom << nonce << user_agent << start_height;
46 versionPayload.
size());
51 expectedVersion << versionhdr << versionPayload;
54 serviceFlags, now, addrTo, addrFrom, nonce, user_agent,
63 std::vector<uint8_t> payload;
67 expectedVerack << verackHeader;
76 "0000000099f5509b5f36b1926bcf82b21d936ebeadee811030dfbbb7fae915d7"));
77 std::vector<BlockHash> vlocator(1, bhash);
79 payload << locatorhash <<
uint256();
87 expectedMsg << msgHeader << payload;
92BOOST_AUTO_TEST_SUITE_END()
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given BIP70 chain name.
const CChainParams & Params()
Return the currently selected parameters.
A CService with information about it as peer.
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
Double ended buffer combining vector and stream-like interfaces.
A combination of a network address (CNetAddr) and a (TCP) port.
uint256 Hash(const T &in1)
Compute the 256-bit hash of an object.
static void CheckMessage(CDataStream &expectedMessage, std::string command, Args &&...args)
BOOST_AUTO_TEST_CASE(simple_header_and_payload_message_writer_test)
static void WriteMessage(CDataStream &stream, std::string command, Args &&...args)
const char * VERSION
The version message provides information about the transmitting node to the receiving node at the beg...
const char * GETHEADERS
The getheaders message requests a headers message that provides block headers starting from a particu...
const char * VERACK
The verack message acknowledges a previously-received version message, informing the connecting node ...
#define BOOST_CHECK_EQUAL(v1, v2)
ServiceFlags
nServices flags.
A BlockHash is a unqiue identifier for a block.
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
uint256 uint256S(const char *str)
uint256 from const char *.
static const int PROTOCOL_VERSION
network protocol versioning