Skip to content

Commit

Permalink
UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
levoncrypto committed Aug 7, 2024
1 parent ee6456a commit b3412ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/qt/recover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Recover::Recover(QWidget *parent) :
thread->start();

connect(ui->enableDateSelection, &QCheckBox::toggled, this, &Recover::updateDateInputState);
ui->dateInput->setDisplayFormat("dd-MM-yyyy");
ui->dateInput->setMinimumDate(QDate(2020, 3, 23));
}

Recover::~Recover()
Expand Down Expand Up @@ -62,14 +64,14 @@ void Recover::setCreateNew()

void Recover::updateDateInputState(bool checked) {
ui->dateInput->setEnabled(checked);
if (checked) {
ui->dateInput->setMinimumDate(QDate(2020, 3, 23));
}
ui->dateInput->setMinimumDate(QDate(2020, 3, 23));
}

void Recover::on_createNew_clicked()
{
setCreateNew();
ui->dateInput->setDisplayFormat("dd-MM-yyyy");
ui->dateInput->setDate(QDate(2020, 3, 23));
}

void Recover::on_recoverExisting_clicked()
Expand All @@ -79,6 +81,8 @@ void Recover::on_recoverExisting_clicked()
ui->dateInput->setEnabled(true);
ui->dateInput->setEnabled(ui->enableDateSelection->isChecked());
ui->enableDateSelection->setEnabled(true);
ui->dateInput->setDisplayFormat("dd-MM-yyyy");
ui->dateInput->setDate(ui->dateInput->minimumDate());
}

void Recover::on_usePassphrase_clicked()
Expand Down Expand Up @@ -122,6 +126,9 @@ bool Recover::askRecover(bool& newWallet)
newWallet = false;
std::string mnemonic = recover.ui->mnemonicWords->text().toStdString();
if (recover.ui->enableDateSelection->isChecked()) {
QDate date = recover.ui->dateInput->date();
QDate newDate = date.addDays(-1);
recover.ui->dateInput->setDate(newDate);
SoftSetArg("-wcdate", recover.ui->dateInput->text().toStdString());
} else {
SoftSetArg("-wcdate", "");
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,11 +2408,12 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex *pindexStart, bool f
// no need to read and scan block, if block was created before
// our wallet birthday (as adjusted for block time variability)
// if you are recovering wallet with mnemonics start rescan from block when mnemonics implemented in Firo
int targetHeight = 0;
if (fRecoverMnemonic) {
std::string wcdate = GetArg("-wcdate", "");
CBlockIndex* mnemonicStartBlock = chainActive[chainParams.GetConsensus().nMnemonicBlock];
targetHeight = GetBlockHeightByDate(mnemonicStartBlock, wcdate);
if (!wcdate.empty()) {
int targetHeight = GetBlockHeightByDate(mnemonicStartBlock, wcdate);
if (targetHeight <= 0) {
targetHeight = chainParams.GetConsensus().nMnemonicBlock;
}
Expand All @@ -2423,7 +2424,7 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex *pindexStart, bool f
} else
while (pindex && nTimeFirstKey && (pindex->GetBlockTime() < (nTimeFirstKey - 7200)))
pindex = chainActive.Next(pindex);

LogPrintf("Rescanning last %i blocks (from block %i)...\n", chainActive.Height(), targetHeight);
ShowProgress(_("Rescanning..."), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
double dProgressStart = GuessVerificationProgress(chainParams.TxData(), pindex);
double dProgressTip = GuessVerificationProgress(chainParams.TxData(), chainActive.Tip());
Expand Down Expand Up @@ -7314,7 +7315,6 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
}

uiInterface.InitMessage(_("Rescanning..."));
LogPrintf("Rescanning last %i blocks (from block %i)...\n", chainActive.Height() - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis();
walletInstance->ScanForWalletTransactions(pindexRescan, true, fRecoverMnemonic);
LogPrintf(" rescan %15dms\n", GetTimeMillis() - nStart);
Expand Down

0 comments on commit b3412ba

Please sign in to comment.