Update qt.cpp to match block_count RPC & fix bug with pruned display (#4000)

* Update qt.cpp to match block_count RPC & fix bug with pruned display

Currently the QT wallet 1) does not show cemented count, 2) has "Full" directly appended to the unchecked count (no comma or space), and the "Pruned" count is always empty (due to a minor concatenation bug). This change fixes that

* Update qt.cpp

Removing if-statements for cemented and unchecked, per https://github.com/nanocurrency/nano-node/pull/4000#pullrequestreview-1182747759

* Update qt.cpp

Renaming "Queued" to "Unchecked" per colloquial usage and comment here: https://github.com/nanocurrency/nano-node/pull/4000#issuecomment-1317202823

* Fix unit test wallet.enter_password

Search that the status line starts with the right words and ignore the
counts, which are not directly relevant to this test.

Co-authored-by: Dimitrios Siganos <dimitris@siganos.org>
This commit is contained in:
qwahzi 2022-11-17 04:14:55 -06:00 committed by GitHub
commit da37e91b39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View file

@ -957,15 +957,13 @@ std::string nano_qt::status::text ()
}
result += ", Blocks: ";
if (unchecked != 0 && wallet.node.bootstrap_initiator.in_progress ())
{
count_string += ", Queued: " + std::to_string (unchecked);
}
count_string += ", Unchecked: " + std::to_string (unchecked);
count_string += ", Cemented: " + std::to_string (cemented);
if (wallet.node.flags.enable_pruning)
{
count_string += "Full: " + std::to_string (wallet.wallet_m->wallets.node.ledger.cache.block_count - wallet.wallet_m->wallets.node.ledger.cache.pruned_count);
count_string += ", Pruned: ", std::to_string (wallet.wallet_m->wallets.node.ledger.cache.pruned_count);
count_string += ", Full: " + std::to_string (wallet.wallet_m->wallets.node.ledger.cache.block_count - wallet.wallet_m->wallets.node.ledger.cache.pruned_count);
count_string += ", Pruned: " + std::to_string (wallet.wallet_m->wallets.node.ledger.cache.pruned_count);
}
result += count_string.c_str ();

View file

@ -272,7 +272,7 @@ TEST (wallet, enter_password)
QTest::mouseClick (wallet->settings.lock_toggle, Qt::LeftButton);
QTest::mouseClick (wallet->settings.lock_toggle, Qt::LeftButton);
test_application->processEvents ();
ASSERT_EQ ("Status: Wallet password empty, Blocks: 1", wallet->status->text ().toStdString ());
ASSERT_NE (wallet->status->text ().toStdString ().rfind ("Status: Wallet password empty", 0), std::string::npos);
{
auto transaction (system.nodes[0]->wallets.tx_begin_write ());
ASSERT_FALSE (system.wallet (0)->store.rekey (transaction, "abc"));
@ -280,12 +280,12 @@ TEST (wallet, enter_password)
QTest::mouseClick (wallet->settings_button, Qt::LeftButton);
QTest::mouseClick (wallet->settings.lock_toggle, Qt::LeftButton);
test_application->processEvents ();
ASSERT_EQ ("Status: Wallet locked, Blocks: 1", wallet->status->text ().toStdString ());
ASSERT_NE (wallet->status->text ().toStdString ().rfind ("Status: Wallet locked", 0), std::string::npos);
wallet->settings.new_password->setText ("");
QTest::keyClicks (wallet->settings.password, "abc");
QTest::mouseClick (wallet->settings.lock_toggle, Qt::LeftButton);
test_application->processEvents ();
ASSERT_EQ ("Status: Running, Blocks: 1", wallet->status->text ().toStdString ());
ASSERT_NE (wallet->status->text ().toStdString ().rfind ("Status: Running", 0), std::string::npos);
ASSERT_EQ ("", wallet->settings.password->text ());
}