Wallet only goes in to synchronization once a connection is established.

This commit is contained in:
clemahieu 2017-02-05 22:45:16 -06:00
commit 543ef0c18a
2 changed files with 13 additions and 3 deletions

View file

@ -892,7 +892,13 @@ void rai::bootstrap_initiator::add_observer (std::function <void (bool)> const &
bool rai::bootstrap_initiator::in_progress ()
{
return attempt.lock () != nullptr;
auto result (false);
auto attempt_l (attempt.lock ());
if (attempt_l != nullptr)
{
result = attempt_l->connected;
}
return result;
}
void rai::bootstrap_initiator::stop ()

View file

@ -32,9 +32,13 @@ TEST (wallet, status)
ASSERT_EQ ("Status: Disconnected", wallet.status->text ().toStdString ());
system.nodes [0]->peers.insert (rai::endpoint (boost::asio::ip::address_v6::loopback (), 10000));
ASSERT_NE ("Status: Synchronizing", wallet.status->text ().toStdString ());
auto iterations (0);
while (wallet.status->text ().toStdString () != "Status: Synchronizing")
{
test_application->processEvents ();
system.poll ();
++iterations;
ASSERT_LT (iterations, 200);
}
system.nodes [0]->peers.purge_list (std::chrono::system_clock::now () + std::chrono::seconds (5));
while (wallet.status->text ().toStdString () == "Status: Synchronizing")
@ -51,7 +55,7 @@ TEST (wallet, startup_balance)
rai::keypair key;
wallet_l->insert_adhoc (key.prv);
rai_qt::wallet wallet (*test_application, *system.nodes [0], wallet_l, key.pub);
ASSERT_EQ ("Balance: 0 Mrai", wallet.self.balance_label->text().toStdString ());
ASSERT_EQ ("Balance: 0", wallet.self.balance_label->text().toStdString ());
}
TEST (wallet, select_account)
@ -677,4 +681,4 @@ TEST (wallet, import_locked)
rai::raw_key seed3;
system.wallet (0)->store.seed (seed3, rai::transaction (system.wallet (0)->store.environment, nullptr, false));
ASSERT_EQ (seed1, seed3);
}
}