11#include <ipc/capnp/mining.capnp.h>
12#include <ipc/test/ipc_test.capnp.h>
13#include <ipc/test/ipc_test.capnp.proxy.h>
16#include <validation.h>
25#include <boost/test/unit_test.hpp>
27static_assert(ipc::capnp::messages::MAX_MONEY ==
MAX_MONEY);
28static_assert(ipc::capnp::messages::MAX_DOUBLE == std::numeric_limits<double>::max());
63 std::promise<std::unique_ptr<mp::ProxyClient<gen::FooInterface>>>
foo_promise;
64 std::thread thread([&]() {
65 mp::EventLoop loop(
"IpcPipeTest", [](
bool raise,
const std::string& log) {
LogInfo(
"LOG%i: %s", raise, log); });
69 auto foo_client = std::make_unique<mp::ProxyClient<gen::FooInterface>>(
76 auto foo_server = kj::heap<mp::ProxyServer<gen::FooInterface>>(std::make_shared<FooImplementation>(), connection);
77 return capnp::Capability::Client(kj::mv(foo_server));
82 std::unique_ptr<mp::ProxyClient<gen::FooInterface>>
foo{
foo_promise.get_future().get()};
93 uni1.pushKV(
"s",
"two");
106 std::vector<char>
vec1{
'H',
'e',
'l',
'l',
'o'};
124 std::unique_ptr<interfaces::Init>
init{std::make_unique<TestInit>()};
127 std::thread thread([&]() {
142 std::unique_ptr<interfaces::Init>
init{std::make_unique<TestInit>()};
182 for (
int i : {0, 1, 0, 0, 1}) {
static constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
static constexpr CAmount COIN
The amount of satoshis in one BTC.
#define Assert(val)
Identity function.
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
std::unique_ptr< interfaces::Echo > makeEcho() override
void pushKV(std::string key, UniValue val)
Initial interface created when a process is first started, and used to give and get access to other i...
Object holding network & rpc state associated with either an incoming server connection,...
Event loop implementation.
kj::AsyncIoContext m_io_context
Capnp IO context.
static transaction_identifier FromUint256(const uint256 &id)
static std::string PathToString(const path &path)
Convert path object to a byte string.
static path PathFromString(const std::string &string)
Convert byte string to path object.
std::string HexStr(const std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
static std::string TempPath(std::string_view pattern)
Generate a temporary path with temp_directory_path and mkstemp.
void IpcSocketTest(const fs::path &datadir)
Test ipc::Process bind() and connect() methods connecting over a unix socket.
void IpcPipeTest()
Unit test that tests execution of IPC calls without actually creating a separate process.
void IpcSocketPairTest()
Test ipc::Protocol connect() and serve() methods connecting over a socketpair.
std::unique_ptr< Echo > MakeEcho()
Return implementation of Echo interface.
std::unique_ptr< Protocol > MakeCapnpProtocol()
std::unique_ptr< Process > MakeProcess()
Constructor for Process interface.
#define BOOST_CHECK_THROW(stmt, excMatch)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
static constexpr unsigned int DEFAULT_COINBASE_OUTPUT_MAX_ADDITIONAL_SIGOPS
Default sigops cost to reserve for coinbase transaction outputs when creating block templates.
static constexpr unsigned int DEFAULT_BLOCK_RESERVED_WEIGHT
Default for -blockreservedweight.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
A mutable version of CTransaction.
Vat id for server side of connection.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.