mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-30 07:43:48 +02:00
Add src/node/* code to node:: namespace
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using node::BlockAssembler;
|
||||
using node::CBlockTemplate;
|
||||
using node::IncrementExtraNonce;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(blockfilter_index_tests)
|
||||
|
||||
struct BuildChainTestingSetup : public TestChain100Setup {
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
using node::CCoinsStats;
|
||||
using node::CoinStatsHashType;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(coinstatsindex_tests)
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using node::CCoinsStats;
|
||||
using node::CoinStatsHashType;
|
||||
using node::GetUTXOStats;
|
||||
|
||||
namespace {
|
||||
const TestingSetup* g_setup;
|
||||
const Coin EMPTY_COIN{};
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include <test/fuzz/fuzz.h>
|
||||
|
||||
using node::SnapshotMetadata;
|
||||
|
||||
void initialize_deserialize()
|
||||
{
|
||||
// Fuzzers using pubkey must hold an ECCVerifyHandle.
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <map>
|
||||
#include <numeric>
|
||||
|
||||
using node::MakeMinisketch32;
|
||||
|
||||
FUZZ_TARGET(minisketch)
|
||||
{
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using node::AnalyzePSBT;
|
||||
using node::PSBTAnalysis;
|
||||
using node::PSBTInputAnalysis;
|
||||
|
||||
void initialize_psbt()
|
||||
{
|
||||
static const ECCVerifyHandle verify_handle;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
using node::BlockAssembler;
|
||||
|
||||
namespace {
|
||||
|
||||
const TestingSetup* g_setup;
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
using node::SnapshotMetadata;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::shared_ptr<CBlock>>* g_chain;
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using node::BlockAssembler;
|
||||
using node::CBlockTemplate;
|
||||
|
||||
namespace miner_tests {
|
||||
struct MinerTestingSetup : public TestingSetup {
|
||||
void TestPackageSelection(const CChainParams& chainparams, const CScript& scriptPubKey, const std::vector<CTransactionRef>& txFirst) EXCLUSIVE_LOCKS_REQUIRED(::cs_main, m_node.mempool->cs);
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
using node::MakeMinisketch32;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(minisketch_tests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(minisketch_test)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <node/blockstorage.h>
|
||||
#include <validation.h>
|
||||
|
||||
using node::ReadBlockFromDisk;
|
||||
using node::UndoReadFromDisk;
|
||||
|
||||
bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
const auto NoMalleation = [](CAutoFile& file, SnapshotMetadata& meta){};
|
||||
const auto NoMalleation = [](CAutoFile& file, node::SnapshotMetadata& meta){};
|
||||
|
||||
/**
|
||||
* Create and activate a UTXO snapshot, optionally providing a function to
|
||||
@@ -24,7 +24,7 @@ const auto NoMalleation = [](CAutoFile& file, SnapshotMetadata& meta){};
|
||||
*/
|
||||
template<typename F = decltype(NoMalleation)>
|
||||
static bool
|
||||
CreateAndActivateUTXOSnapshot(NodeContext& node, const fs::path root, F malleation = NoMalleation)
|
||||
CreateAndActivateUTXOSnapshot(node::NodeContext& node, const fs::path root, F malleation = NoMalleation)
|
||||
{
|
||||
// Write out a snapshot to the test's tempdir.
|
||||
//
|
||||
@@ -43,7 +43,7 @@ CreateAndActivateUTXOSnapshot(NodeContext& node, const fs::path root, F malleati
|
||||
//
|
||||
FILE* infile{fsbridge::fopen(snapshot_path, "rb")};
|
||||
CAutoFile auto_infile{infile, SER_DISK, CLIENT_VERSION};
|
||||
SnapshotMetadata metadata;
|
||||
node::SnapshotMetadata metadata;
|
||||
auto_infile >> metadata;
|
||||
|
||||
malleation(auto_infile, metadata);
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#include <validation.h>
|
||||
#include <versionbits.h>
|
||||
|
||||
using node::BlockAssembler;
|
||||
using node::NodeContext;
|
||||
|
||||
CTxIn generatetoaddress(const NodeContext& node, const std::string& address)
|
||||
{
|
||||
const auto dest = DecodeDestination(address);
|
||||
|
||||
@@ -13,18 +13,20 @@ class CBlock;
|
||||
class CChainParams;
|
||||
class CScript;
|
||||
class CTxIn;
|
||||
namespace node {
|
||||
struct NodeContext;
|
||||
} // namespace node
|
||||
|
||||
/** Create a blockchain, starting from genesis */
|
||||
std::vector<std::shared_ptr<CBlock>> CreateBlockChain(size_t total_height, const CChainParams& params);
|
||||
|
||||
/** Returns the generated coin */
|
||||
CTxIn MineBlock(const NodeContext&, const CScript& coinbase_scriptPubKey);
|
||||
CTxIn MineBlock(const node::NodeContext&, const CScript& coinbase_scriptPubKey);
|
||||
|
||||
/** Prepare a block to be mined */
|
||||
std::shared_ptr<CBlock> PrepareBlock(const NodeContext&, const CScript& coinbase_scriptPubKey);
|
||||
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext&, const CScript& coinbase_scriptPubKey);
|
||||
|
||||
/** RPC-like helper function, returns the generated coin */
|
||||
CTxIn generatetoaddress(const NodeContext&, const std::string& address);
|
||||
CTxIn generatetoaddress(const node::NodeContext&, const std::string& address);
|
||||
|
||||
#endif // BITCOIN_TEST_UTIL_MINING_H
|
||||
|
||||
@@ -43,6 +43,14 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
using node::BlockAssembler;
|
||||
using node::CalculateCacheSizes;
|
||||
using node::LoadChainstate;
|
||||
using node::RegenerateCommitments;
|
||||
using node::VerifyLoadedChainstate;
|
||||
using node::fPruneMode;
|
||||
using node::fReindex;
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
UrlDecodeFn* const URL_DECODE = nullptr;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ static constexpr CAmount CENT{1000000};
|
||||
*/
|
||||
struct BasicTestingSetup {
|
||||
ECCVerifyHandle globalVerifyHandle;
|
||||
NodeContext m_node;
|
||||
node::NodeContext m_node;
|
||||
|
||||
explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN, const std::vector<const char*>& extra_args = {});
|
||||
~BasicTestingSetup();
|
||||
@@ -90,7 +90,7 @@ struct BasicTestingSetup {
|
||||
* initialization behaviour.
|
||||
*/
|
||||
struct ChainTestingSetup : public BasicTestingSetup {
|
||||
CacheSizes m_cache_sizes{};
|
||||
node::CacheSizes m_cache_sizes{};
|
||||
|
||||
explicit ChainTestingSetup(const std::string& chainName = CBaseChainParams::MAIN, const std::vector<const char*>& extra_args = {});
|
||||
~ChainTestingSetup();
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include <thread>
|
||||
|
||||
using node::BlockAssembler;
|
||||
|
||||
namespace validation_block_tests {
|
||||
struct MinerTestingSetup : public RegTestingSetup {
|
||||
std::shared_ptr<CBlock> Block(const uint256& prev_hash);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using node::SnapshotMetadata;
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(validation_chainstatemanager_tests, ChainTestingSetup)
|
||||
|
||||
//! Basic tests for ChainstateManager.
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using node::BlockManager;
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(validation_flush_tests, ChainTestingSetup)
|
||||
|
||||
//! Test utilities for detecting when we need to flush the coins cache based
|
||||
|
||||
Reference in New Issue
Block a user