CurrentBlockchainStatus::monitor_blockchain tested

pull/93/merge
moneroexamples 6 years ago
parent 65cd066b19
commit b36db3f0d9

@ -30,12 +30,17 @@ CurrentBlockchainStatus::monitor_blockchain()
TxSearch::set_search_thread_life(
bc_setup.search_thread_life_in_seconds);
stop_blockchain_monitor_loop = false;
if (!is_running)
{
is_running = true;
while (is_running)
while (true)
{
if (stop_blockchain_monitor_loop)
break;
update_current_blockchain_height();
read_mempool();
OMINFO << "Current blockchain height: " << current_height
@ -45,6 +50,8 @@ CurrentBlockchainStatus::monitor_blockchain()
std::chrono::seconds(
bc_setup.refresh_block_status_every_seconds));
}
is_running = false;
}
}

@ -53,6 +53,7 @@ public:
atomic<uint64_t> current_height;
atomic<bool> is_running;
atomic<bool> stop_blockchain_monitor_loop;
CurrentBlockchainStatus(BlockchainSetup _bc_setup,
std::unique_ptr<MicroCore> _mcore,

File diff suppressed because one or more lines are too long

@ -58,7 +58,8 @@ TEST_P(BlockchainSetupTest, ReadInConfigFile)
EXPECT_EQ(bc_setup.import_payment_address_str,
config_json["wallet_import"][net_name]["address"]);
// we expact that bc_setup will have json config equal to what we read manually
// we expact that bc_setup will have json config
// equal to what we read manually
EXPECT_EQ(bc_setup.get_config(), config_json);
xmreg::BlockchainSetup bc_setup2 {net_type, do_not_relay, config_json};
@ -100,7 +101,8 @@ TEST_P(BlockchainSetupTest, ReadInConfigFileFailure)
try
{
// expect throw if confing file is illformed and cant be parsed into json
// expect throw if confing file is illformed and cant be parsed
// into json
xmreg::BlockchainSetup bc_setup {net_type, do_not_relay, confing_path};
}
catch (std::exception const& e)
@ -210,7 +212,8 @@ TEST_P(BlockchainSetupTest, WrongBlockchainPath)
json config_json = xmreg::BlockchainSetup::read_config(config_path);
// make mistake in address
config_json["blockchain-path"][net_name]= string {"/wrong/path/to/bloclckahin"};
config_json["blockchain-path"][net_name]
= string {"/wrong/path/to/bloclckahin"};
try
{
@ -292,12 +295,6 @@ TEST_F(MICROCORE_TEST, InitializationSuccess)
// }
//};
//TEST_F(MICROCORE_TEST, InitializationFailure)
//{
// xmreg::MicroCore mcore;
// EXPECT_FALSE(mcore.init<MockBlockchainDB<false>>(bc_setup.blockchain_path, net_type));
// EXPECT_FALSE(mcore.init<MockBlockchainDB<true>>(bc_setup.blockchain_path, net_type));
//}
}

Loading…
Cancel
Save