Skip to content

Commit bebea4b

Browse files
committed
fix: auto backup issue with descriptor wallets for CJ
1 parent 37e026a commit bebea4b

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

src/coinjoin/client.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,9 @@ bool CCoinJoinClientManager::CheckAutomaticBackup()
715715
{
716716
if (!CCoinJoinClientOptions::IsEnabled() || !IsMixing()) return false;
717717

718+
// We don't need auto-backups for descriptor wallets
719+
if (!m_wallet.IsLegacy()) return true;
720+
718721
switch (nWalletBackups) {
719722
case 0:
720723
strAutoDenomResult = _("Automatic backups disabled") + Untranslated(", ") + _("no mixing available.");

src/qt/overviewpage.cpp

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,10 @@ void OverviewPage::coinJoinStatus(bool fForce)
539539
if(walletModel->getKeysLeftSinceAutoBackup() < COINJOIN_KEYS_THRESHOLD_WARNING) {
540540
strKeysLeftText = "<span style='" + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + "'>" + strKeysLeftText + "</span>";
541541
}
542+
if (!walletModel->wallet().isLegacy()) {
543+
// we don't need in auto-back for case of Descriptor wallets
544+
strKeysLeftText = "";
545+
}
542546
ui->labelCoinJoinEnabled->setToolTip(strKeysLeftText);
543547

544548
QString strCoinJoinName = QString::fromStdString(gCoinJoinName);
@@ -553,7 +557,7 @@ void OverviewPage::coinJoinStatus(bool fForce)
553557

554558
QString strEnabled = tr("Disabled");
555559
// Show how many keys left in advanced PS UI mode only
556-
if (fShowAdvancedCJUI) strEnabled += ", " + strKeysLeftText;
560+
if (fShowAdvancedCJUI && !strKeysLeftText.isEmpty()) strEnabled += ", " + strKeysLeftText;
557561
ui->labelCoinJoinEnabled->setText(strEnabled);
558562

559563
// If mixing isn't active always show the lower number of txes because there are
@@ -567,7 +571,7 @@ void OverviewPage::coinJoinStatus(bool fForce)
567571

568572
// Warn user that wallet is running out of keys
569573
// NOTE: we do NOT warn user and do NOT create autobackups if mixing is not running
570-
if (nWalletBackups > 0 && walletModel->getKeysLeftSinceAutoBackup() < COINJOIN_KEYS_THRESHOLD_WARNING) {
574+
if (walletModel->wallet().isLegacy() && nWalletBackups > 0 && walletModel->getKeysLeftSinceAutoBackup() < COINJOIN_KEYS_THRESHOLD_WARNING) {
571575
QSettings settings;
572576
if(settings.value("fLowKeysWarning").toBool()) {
573577
QString strWarn = tr("Very low number of keys left since last automatic backup!") + "<br><br>" +
@@ -607,23 +611,25 @@ void OverviewPage::coinJoinStatus(bool fForce)
607611

608612
QString strEnabled = walletModel->coinJoin()->isMixing() ? tr("Enabled") : tr("Disabled");
609613
// Show how many keys left in advanced PS UI mode only
610-
if(fShowAdvancedCJUI) strEnabled += ", " + strKeysLeftText;
614+
if(fShowAdvancedCJUI && !strKeysLeftText.isEmpty()) strEnabled += ", " + strKeysLeftText;
611615
ui->labelCoinJoinEnabled->setText(strEnabled);
612616

613-
if(nWalletBackups == -1) {
614-
// Automatic backup failed, nothing else we can do until user fixes the issue manually
615-
DisableCoinJoinCompletely();
617+
if (walletModel->wallet().isLegacy()) {
618+
if(nWalletBackups == -1) {
619+
// Automatic backup failed, nothing else we can do until user fixes the issue manually
620+
DisableCoinJoinCompletely();
616621

617-
QString strError = tr("ERROR! Failed to create automatic backup") + ", " +
618-
tr("see debug.log for details.") + "<br><br>" +
619-
tr("Mixing is disabled, please close your wallet and fix the issue!");
620-
ui->labelCoinJoinEnabled->setToolTip(strError);
622+
QString strError = tr("ERROR! Failed to create automatic backup") + ", " +
623+
tr("see debug.log for details.") + "<br><br>" +
624+
tr("Mixing is disabled, please close your wallet and fix the issue!");
625+
ui->labelCoinJoinEnabled->setToolTip(strError);
621626

622-
return;
623-
} else if(nWalletBackups == -2) {
624-
// We were able to create automatic backup but keypool was not replenished because wallet is locked.
625-
QString strWarning = tr("WARNING! Failed to replenish keypool, please unlock your wallet to do so.");
626-
ui->labelCoinJoinEnabled->setToolTip(strWarning);
627+
return;
628+
} else if(nWalletBackups == -2) {
629+
// We were able to create automatic backup but keypool was not replenished because wallet is locked.
630+
QString strWarning = tr("WARNING! Failed to replenish keypool, please unlock your wallet to do so.");
631+
ui->labelCoinJoinEnabled->setToolTip(strWarning);
632+
}
627633
}
628634

629635
// check coinjoin status and unlock if needed

0 commit comments

Comments
 (0)