diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit_tests/long_term_block_weight.cpp | 15 |
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) |