aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-11-09 22:44:39 -0600
committerluigi1111 <luigi1111w@gmail.com>2021-11-09 22:44:39 -0600
commitc3b1b94453b3c6b6e78f5ae5d9d9ba4e6e63a961 (patch)
tree50d7fad62375e1f89abebb98307273b0e47deeac /tests/unit_tests
parentMerge pull request #8021 (diff)
parenttx_pool: full tx revalidation on fork boundaries (diff)
downloadmonero-c3b1b94453b3c6b6e78f5ae5d9d9ba4e6e63a961.tar.xz
Merge pull request #7169
bbe3b27 tx_pool: full tx revalidation on fork boundaries (moneromooo-monero)
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/long_term_block_weight.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/unit_tests/long_term_block_weight.cpp b/tests/unit_tests/long_term_block_weight.cpp
index f075034bd..c0b057c9a 100644
--- a/tests/unit_tests/long_term_block_weight.cpp
+++ b/tests/unit_tests/long_term_block_weight.cpp
@@ -106,10 +106,16 @@ 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) \
- std::unique_ptr<cryptonote::Blockchain> bc; \
- cryptonote::tx_memory_pool txpool(*bc); \
- bc.reset(new cryptonote::Blockchain(txpool)); \
+ BlockchainAndPool bap; \
+ cryptonote::Blockchain *bc = &bap.bc; \
struct get_test_options { \
const std::pair<uint8_t, uint64_t> hard_forks[3]; \
const cryptonote::test_options test_options = { \
@@ -118,8 +124,7 @@ static uint32_t lcg()
}; \
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(); \
- bool r = blockchain->init(new TestDB(), cryptonote::FAKECHAIN, true, &opts.test_options, 0, NULL); \
+ bool r = bc->init(new TestDB(), cryptonote::FAKECHAIN, true, &opts.test_options, 0, NULL); \
ASSERT_TRUE(r)
#define PREFIX(hf_version) PREFIX_WINDOW(hf_version, TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW)