aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/long_term_block_weight.cpp11
-rw-r--r--tests/unit_tests/output_distribution.cpp12
-rw-r--r--tests/unit_tests/scaling_2021.cpp7
3 files changed, 8 insertions, 22 deletions
diff --git a/tests/unit_tests/long_term_block_weight.cpp b/tests/unit_tests/long_term_block_weight.cpp
index b9ce2b247..e52bd1955 100644
--- a/tests/unit_tests/long_term_block_weight.cpp
+++ b/tests/unit_tests/long_term_block_weight.cpp
@@ -106,16 +106,9 @@ static uint32_t lcg()
}
-struct BlockchainAndPool
-{
- cryptonote::tx_memory_pool txpool;
- cryptonote::Blockchain bc;
- BlockchainAndPool(): txpool(bc), bc(txpool) {}
-};
-
#define PREFIX_WINDOW(hf_version,window) \
- BlockchainAndPool bap; \
- cryptonote::Blockchain *bc = &bap.bc; \
+ cryptonote::BlockchainAndPool bap; \
+ cryptonote::Blockchain *bc = &bap.blockchain; \
struct get_test_options { \
const std::pair<uint8_t, uint64_t> hard_forks[3]; \
const cryptonote::test_options test_options = { \
diff --git a/tests/unit_tests/output_distribution.cpp b/tests/unit_tests/output_distribution.cpp
index ab474a7d8..038c19874 100644
--- a/tests/unit_tests/output_distribution.cpp
+++ b/tests/unit_tests/output_distribution.cpp
@@ -30,10 +30,7 @@
#include "gtest/gtest.h"
#include "misc_log_ex.h"
#include "rpc/rpc_handler.h"
-#include "blockchain_db/blockchain_db.h"
#include "cryptonote_core/cryptonote_core.h"
-#include "cryptonote_core/tx_pool.h"
-#include "cryptonote_core/blockchain.h"
#include "blockchain_db/testdb.h"
static const uint64_t test_distribution[32] = {
@@ -77,9 +74,6 @@ public:
bool get_output_distribution(uint64_t amount, uint64_t from, uint64_t to, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base)
{
- std::unique_ptr<cryptonote::Blockchain> bc;
- cryptonote::tx_memory_pool txpool(*bc);
- bc.reset(new cryptonote::Blockchain(txpool));
struct get_test_options {
const std::pair<uint8_t, uint64_t> hard_forks[2];
const cryptonote::test_options test_options = {
@@ -87,9 +81,9 @@ bool get_output_distribution(uint64_t amount, uint64_t from, uint64_t to, uint64
};
get_test_options():hard_forks{std::make_pair((uint8_t)1, (uint64_t)0), std::make_pair((uint8_t)0, (uint64_t)0)}{}
} opts;
- cryptonote::Blockchain *blockchain = bc.get();
- bool r = blockchain->init(new TestDB(test_distribution_size), cryptonote::FAKECHAIN, true, &opts.test_options, 0, NULL);
- return r && bc->get_output_distribution(amount, from, to, start_height, distribution, base);
+ cryptonote::BlockchainAndPool bap;
+ bool r = bap.blockchain.init(new TestDB(test_distribution_size), cryptonote::FAKECHAIN, true, &opts.test_options, 0, NULL);
+ return r && bap.blockchain.get_output_distribution(amount, from, to, start_height, distribution, base);
}
crypto::hash get_block_hash(uint64_t height)
diff --git a/tests/unit_tests/scaling_2021.cpp b/tests/unit_tests/scaling_2021.cpp
index 024a4b4fd..d90f0f9e6 100644
--- a/tests/unit_tests/scaling_2021.cpp
+++ b/tests/unit_tests/scaling_2021.cpp
@@ -50,9 +50,6 @@ public:
}
#define PREFIX_WINDOW(hf_version,window) \
- std::unique_ptr<cryptonote::Blockchain> bc; \
- cryptonote::tx_memory_pool txpool(*bc); \
- bc.reset(new cryptonote::Blockchain(txpool)); \
struct get_test_options { \
const std::pair<uint8_t, uint64_t> hard_forks[3]; \
const cryptonote::test_options test_options = { \
@@ -61,7 +58,9 @@ public:
}; \
get_test_options(): hard_forks{std::make_pair(1, (uint64_t)0), std::make_pair((uint8_t)hf_version, (uint64_t)1), std::make_pair((uint8_t)0, (uint64_t)0)} {} \
} opts; \
- cryptonote::Blockchain *blockchain = bc.get(); \
+ cryptonote::BlockchainAndPool bap; \
+ cryptonote::Blockchain *blockchain = &bap.blockchain; \
+ cryptonote::Blockchain *bc = blockchain; \
bool r = blockchain->init(new TestDB(), cryptonote::FAKECHAIN, true, &opts.test_options, 0, NULL); \
ASSERT_TRUE(r)