restore rescan height dialog, use safe clear+resync approach
This commit is contained in:
@@ -14,5 +14,5 @@
|
||||
|
||||
| File | SHA-256 |
|
||||
|---|---|
|
||||
| `SilentDragonXLite` (Linux) | `9f60380b66bbe10366f216457273e648c50831ee8da3b8486ca87a21629a4b22` |
|
||||
| `SilentDragonXLite.exe` (Windows) | `26f05e534e4337fac48f6fd36ba17a7de80571e1e565944a7d104ef9419d5efb` |
|
||||
| `SilentDragonXLite` (Linux) | `ac44fbdfa343ffb550829827e3fbb95407e2ca3086d6bc34befdc7b5644763a7` |
|
||||
| `SilentDragonXLite.exe` (Windows) | `093b6830f23b1f1d407c47f2df90a2c1465b2882a0c3b375237a5b731e36362c` |
|
||||
|
||||
Binary file not shown.
@@ -161,10 +161,29 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QObject::connect(ui->actionRescan, &QAction::triggered, [=]() {
|
||||
DEBUG("rescan action triggered");
|
||||
|
||||
// Clear the wallet state and resync from the birthday height.
|
||||
// This uses the existing LightClient — no need to reinitialize.
|
||||
this->getRPC()->clearWallet([=] (auto) {
|
||||
qDebug() << "Clearing wallet state for rescan...";
|
||||
// Ask user for rescan height
|
||||
bool ok;
|
||||
QString heightStr = QInputDialog::getText(this, tr("Rescan Wallet"),
|
||||
tr("Rescan from height (0 to rescan from the beginning):"),
|
||||
QLineEdit::Normal, "0", &ok);
|
||||
|
||||
if (!ok) return;
|
||||
|
||||
QString height = heightStr.trimmed();
|
||||
if (height.isEmpty()) height = "0";
|
||||
|
||||
// Validate it's a number
|
||||
height.toULongLong(&ok);
|
||||
if (!ok) {
|
||||
QMessageBox::warning(this, tr("Invalid height"),
|
||||
tr("Please enter a valid block height number."),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear wallet state from the specified height, then resync
|
||||
rpc->getConnection()->doRPCWithDefaultErrorHandling("clear", height, [=] (auto) {
|
||||
qDebug() << "Cleared wallet state to height" << height;
|
||||
this->getRPC()->saveWallet([=] (auto) {
|
||||
qDebug() << "Saved cleared wallet, reloading connection to start rescan...";
|
||||
auto cl = new ConnectionLoader(this, rpc);
|
||||
|
||||
Reference in New Issue
Block a user