44 setup.m_node.chainman.reset();
45 setup.m_make_chainman();
46 setup.LoadVerifyActivateChainstate();
56 static const auto testing_setup{
57 MakeNoLogFileContext<TestingSetup>(
74 const auto block_index_size{
WITH_LOCK(chainman.GetMutex(),
return chainman.BlockIndex().size())};
78 chainman.DisableNextWrite();
84 node.addrman = std::make_unique<AddrMan>(*
node.netgroupman,
true, 0);
89 .reconcile_txs = true,
90 .deterministic_rng = true,
92 connman.SetMsgProc(
node.peerman.get());
93 connman.SetAddrman(*
node.addrman);
95 node.validation_signals->RegisterValidationInterface(
node.peerman.get());
99 std::vector<CNode*> peers;
101 for (
int i = 0; i < num_peers_to_add; ++i) {
103 CNode& p2p_node = *peers.back();
107 connman.AddTestNode(p2p_node);
116 net_msg.
m_type = random_message_type;
121 connman.FlushSendBuffer(random_node);
122 (void)connman.ReceiveMsgFrom(random_node, std::move(net_msg));
124 bool more_work{
true};
129 more_work = connman.ProcessMessagesOnce(random_node);
130 }
catch (
const std::ios_base::failure&) {
132 node.peerman->SendMessages(random_node);
135 node.validation_signals->SyncWithValidationInterfaceQueue();
136 node.validation_signals->UnregisterValidationInterface(
node.peerman.get());
137 node.connman->StopNodes();
138 if (block_index_size !=
WITH_LOCK(chainman.GetMutex(),
return chainman.BlockIndex().size())) {
const TestingSetup * g_setup
Information about a peer.
std::atomic_bool fPauseSend
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
Helper to initialize the global MockableSteadyClock, let a duration elapse, and reset it after use in...
std::string ConsumeBytesAsString(size_t num_bytes)
T ConsumeIntegralInRange(T min, T max)
static Mutex g_msgproc_mutex
Mutex for anything that is only accessed via the msg processing thread.
static std::unique_ptr< PeerManager > make(CConnman &connman, AddrMan &addrman, BanMan *banman, ChainstateManager &chainman, CTxMemPool &pool, node::Warnings &warnings, Options opts)
LIMITED_WHILE(provider.remaining_bytes(), 10000)
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
is used externally by mining IPC clients, so it should only declare simple data definitions.
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH
Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable).
FUZZ_TARGET(process_messages,.init=initialize_process_messages)
void initialize_process_messages()
std::vector< unsigned char > data
void Reset()
Reset the internal state.
Testing setup that configures a complete environment.
Block template creation options.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
SeedRandomStateForTest(SeedRand::ZEROS)
void FillNode(FuzzedDataProvider &fuzzed_data_provider, ConnmanTestMsg &connman, CNode &node) noexcept
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, FakeSteadyClock &clock, const std::optional< NodeId > &node_id_in=std::nullopt)
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
COutPoint MineBlock(const NodeContext &node, const node::BlockCreateOptions &assembler_options)
Returns the generated coin.
@ ZEROS
Seed with a compile time constant of zeros.
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
FuzzedDataProvider & fuzzed_data_provider