Skip to content

Commit

Permalink
Wallet only goes in to synchronization once a connection is established.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Feb 6, 2017
1 parent 965ea1d commit 543ef0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion rai/node/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
8 changes: 6 additions & 2 deletions rai/qt_test/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 543ef0c

Please sign in to comment.