mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 03:29:24 +00:00
coins: don't refresh for each freeze/thaw
Some checks are pending
ci/gh-actions/build / build-ubuntu-without-scanner (push) Waiting to run
ci/gh-actions/guix / cache-sources (push) Waiting to run
ci/gh-actions/guix / aarch64-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / arm-linux-gnueabihf (push) Blocked by required conditions
ci/gh-actions/guix / arm64-apple-darwin (push) Blocked by required conditions
ci/gh-actions/guix / i686-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / riscv64-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-apple-darwin (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-linux-gnu.no-tor-bundle (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-linux-gnu.pack (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-w64-mingw32.installer (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-w64-mingw32 (push) Blocked by required conditions
ci/gh-actions/guix / bundle-logs (push) Blocked by required conditions
Some checks are pending
ci/gh-actions/build / build-ubuntu-without-scanner (push) Waiting to run
ci/gh-actions/guix / cache-sources (push) Waiting to run
ci/gh-actions/guix / aarch64-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / arm-linux-gnueabihf (push) Blocked by required conditions
ci/gh-actions/guix / arm64-apple-darwin (push) Blocked by required conditions
ci/gh-actions/guix / i686-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / riscv64-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-apple-darwin (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-linux-gnu.no-tor-bundle (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-linux-gnu.pack (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-linux-gnu (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-w64-mingw32.installer (push) Blocked by required conditions
ci/gh-actions/guix / x86_64-w64-mingw32 (push) Blocked by required conditions
ci/gh-actions/guix / bundle-logs (push) Blocked by required conditions
This commit is contained in:
parent
796d4dd3f0
commit
fdc7a09c6c
4 changed files with 43 additions and 45 deletions
|
@ -324,18 +324,12 @@ QVector<CoinsInfo*> CoinsWidget::currentEntries() {
|
|||
}
|
||||
|
||||
void CoinsWidget::freezeCoins(QStringList &pubkeys) {
|
||||
for (auto &pubkey : pubkeys) {
|
||||
m_wallet->coins()->freeze(pubkey);
|
||||
}
|
||||
m_wallet->coins()->refresh();
|
||||
m_wallet->coins()->freeze(pubkeys);
|
||||
m_wallet->updateBalance();
|
||||
}
|
||||
|
||||
void CoinsWidget::thawCoins(QStringList &pubkeys) {
|
||||
for (auto &pubkey : pubkeys) {
|
||||
m_wallet->coins()->thaw(pubkey);
|
||||
}
|
||||
m_wallet->coins()->refresh();
|
||||
m_wallet->coins()->thaw(pubkeys);
|
||||
m_wallet->updateBalance();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public slots:
|
|||
void disallowSending();
|
||||
|
||||
private slots:
|
||||
void onDataPasted(const QString &data);
|
||||
void onDataFromQR(const QString &data);
|
||||
|
||||
private:
|
||||
void setupComboBox();
|
||||
|
|
|
@ -105,48 +105,52 @@ quint64 Coins::count() const
|
|||
return m_rows.length();
|
||||
}
|
||||
|
||||
void Coins::freeze(QString &publicKey)
|
||||
void Coins::freeze(QStringList &publicKeys)
|
||||
{
|
||||
crypto::public_key pk;
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
return;
|
||||
|
||||
for (const auto& publicKey : publicKeys) {
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->freeze(pk);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "freeze: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->freeze(pk);
|
||||
refresh();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "freeze: " << e.what();
|
||||
}
|
||||
|
||||
emit coinFrozen();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void Coins::thaw(QString &publicKey)
|
||||
void Coins::thaw(QStringList &publicKeys)
|
||||
{
|
||||
crypto::public_key pk;
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
return;
|
||||
|
||||
for (const auto& publicKey : publicKeys) {
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->thaw(pk);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "thaw: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->thaw(pk);
|
||||
refresh();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "thaw: " << e.what();
|
||||
}
|
||||
|
||||
emit coinThawed();
|
||||
refresh();
|
||||
}
|
||||
|
||||
QVector<CoinsInfo*> Coins::coins_from_txid(const QString &txid)
|
||||
|
|
|
@ -31,8 +31,10 @@ public:
|
|||
CoinsInfo * coin(int index);
|
||||
void refresh();
|
||||
void refreshUnlocked();
|
||||
void freeze(QString &publicKey);
|
||||
void thaw(QString &publicKey);
|
||||
|
||||
void freeze(QStringList &publicKeys);
|
||||
void thaw(QStringList &publicKeys);
|
||||
|
||||
QVector<CoinsInfo*> coins_from_txid(const QString &txid);
|
||||
QVector<CoinsInfo*> coinsFromKeyImage(const QStringList &keyimages);
|
||||
void setDescription(const QString &publicKey, quint32 accountIndex, const QString &description);
|
||||
|
@ -43,8 +45,6 @@ public:
|
|||
signals:
|
||||
void refreshStarted() const;
|
||||
void refreshFinished() const;
|
||||
void coinFrozen() const;
|
||||
void coinThawed() const;
|
||||
void descriptionChanged() const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue