Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
message_writer_tests.cpp
Go to the documentation of this file.
1// Copyright (c) 2020 The Bitcoin developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <hash.h>
6#include <primitives/block.h>
7#include <protocol.h>
9#include <streams.h>
10#include <version.h>
11
12#include <boost/test/unit_test.hpp>
13
14#include <string>
15#include <vector>
16
18
19template <typename... Args>
21 Args &&...args) {
23 MessageWriter::WriteMessage(message, command, std::forward<Args>(args)...);
24 BOOST_CHECK_EQUAL(message.size(), expectedMessage.size());
25 for (size_t i = 0; i < message.size(); i++) {
27 }
28}
29
57
71
91
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.
Definition protocol.h:442
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
Double ended buffer combining vector and stream-like interfaces.
Definition streams.h:177
size_type size() const
Definition streams.h:223
Message header.
Definition protocol.h:34
static constexpr size_t CHECKSUM_SIZE
Definition protocol.h:39
A combination of a network address (CNetAddr) and a (TCP) port.
Definition netaddress.h:545
uint8_t * begin()
Definition uint256.h:85
256-bit opaque blob.
Definition uint256.h:129
uint256 Hash(const T &in1)
Compute the 256-bit hash of an object.
Definition hash.h:75
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...
Definition protocol.cpp:18
const char * GETHEADERS
The getheaders message requests a headers message that provides block headers starting from a particu...
Definition protocol.cpp:27
const char * VERACK
The verack message acknowledges a previously-received version message, informing the connecting node ...
Definition protocol.cpp:19
#define BOOST_CHECK_EQUAL(v1, v2)
Definition object.cpp:18
ServiceFlags
nServices flags.
Definition protocol.h:335
@ NODE_NETWORK
Definition protocol.h:342
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
@ SER_NETWORK
Definition serialize.h:152
A BlockHash is a unqiue identifier for a block.
Definition blockhash.h:13
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
Definition block.h:105
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
Definition time.cpp:109
uint256 uint256S(const char *str)
uint256 from const char *.
Definition uint256.h:143
static const int PROTOCOL_VERSION
network protocol versioning
Definition version.h:11