Search for receivables as a wallet action, rather than a background node task. (#4365)
* Search for receivables as a wallet action, rather than a background node task. * Fix qt unit test wallet.enter_password --------- Co-authored-by: Dimitrios Siganos <dimitris@siganos.org>
This commit is contained in:
parent
250ed204aa
commit
7c7e93166f
2 changed files with 8 additions and 4 deletions
|
|
@ -699,8 +699,9 @@ bool nano::wallet::enter_password (store::transaction const & transaction_a, std
|
|||
auto result (store.attempt_password (transaction_a, password_a));
|
||||
if (!result)
|
||||
{
|
||||
auto this_l (shared_from_this ());
|
||||
wallets.node.background ([this_l] () {
|
||||
auto this_l = shared_from_this ();
|
||||
wallets.node.wallets.queue_wallet_action (nano::wallets::high_priority, this_l, [this_l] (nano::wallet & wallet) {
|
||||
// Wallets must survive node lifetime
|
||||
this_l->search_receivable (this_l->wallets.tx_begin_read ());
|
||||
});
|
||||
wallets.node.logger.try_log ("Wallet unlocked");
|
||||
|
|
|
|||
|
|
@ -285,8 +285,11 @@ TEST (wallet, enter_password)
|
|||
wallet->settings.new_password->setText ("");
|
||||
QTest::keyClicks (wallet->settings.password, "abc");
|
||||
QTest::mouseClick (wallet->settings.lock_toggle, Qt::LeftButton);
|
||||
test_application->processEvents ();
|
||||
ASSERT_NE (wallet->status->text ().toStdString ().rfind ("Status: Running", 0), std::string::npos);
|
||||
auto is_running_status = [&wallet] () -> bool {
|
||||
test_application->processEvents ();
|
||||
return wallet->status->text ().toStdString ().rfind ("Status: Running", 0) != std::string::npos;
|
||||
};
|
||||
ASSERT_TIMELY (5s, is_running_status ());
|
||||
ASSERT_EQ ("", wallet->settings.password->text ());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue