13#include <boost/test/unit_test.hpp>
18BOOST_AUTO_TEST_SUITE(message_writer_tests)
20template <
typename... Args>
26 for (
size_t i = 0; i < message.
size(); i++) {
39 std::string user_agent =
"/Bitcoin ABC:0.0.0(seeder)/";
50 << user_agent << start_height;
53 versionPayload.
size());
58 expectedVersion << versionhdr;
59 expectedVersion.
write(versionPayload);
72 std::vector<uint8_t> payload;
76 expectedVerack << verackHeader;
85 "0000000099f5509b5f36b1926bcf82b21d936ebeadee811030dfbbb7fae915d7"));
86 std::vector<BlockHash> vlocator(1, bhash);
88 payload << locatorhash <<
uint256();
96 expectedMsg << msgHeader;
97 expectedMsg.
write(payload);
102BOOST_AUTO_TEST_SUITE_END()
void SelectParams(const ChainType chain)
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 constexpr SerParams V1_NETWORK
A combination of a network address (CNetAddr) and a (TCP) port.
void write(Span< const value_type > src)
void reserve(size_type n)
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.
static auto WithParams(const Params ¶ms, T &&t)
Return a wrapper around t that (de)serializes it with specified parameter params.
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