|
14 | 14 | #include <interfaces/handler.h> |
15 | 15 | #include <interfaces/init.h> |
16 | 16 | #include <interfaces/node.h> |
| 17 | +#include <interfaces/snapshot.h> |
17 | 18 | #include <logging.h> |
| 19 | +#include <validation.h> |
18 | 20 | #include <node/context.h> |
19 | 21 | #include <node/interface_ui.h> |
20 | 22 | #include <noui.h> |
|
35 | 37 | #include <util/string.h> |
36 | 38 | #include <util/threadnames.h> |
37 | 39 | #include <util/translation.h> |
38 | | -#include <validation.h> |
39 | 40 |
|
40 | 41 | #ifdef ENABLE_WALLET |
41 | 42 | #include <qt/paymentserver.h> |
@@ -319,6 +320,12 @@ void BitcoinApplication::InitPruneSetting(int64_t prune_MiB) |
319 | 320 | optionsModel->SetPruneTargetGB(PruneMiBtoGB(prune_MiB)); |
320 | 321 | } |
321 | 322 |
|
| 323 | +void BitcoinApplication::setSnapshotPath(const QString& snapshot_path) |
| 324 | +{ |
| 325 | + qDebug() << "setSnapshotPath called with:" << snapshot_path; |
| 326 | + m_snapshot_path = snapshot_path; |
| 327 | +} |
| 328 | + |
322 | 329 | void BitcoinApplication::requestInitialize() |
323 | 330 | { |
324 | 331 | qDebug() << __func__ << ": Requesting initialize"; |
@@ -386,7 +393,7 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead |
386 | 393 |
|
387 | 394 | // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete |
388 | 395 | qInfo() << "Platform customization:" << platformStyle->getName(); |
389 | | - clientModel = new ClientModel(node(), optionsModel); |
| 396 | + clientModel = new ClientModel(node(), optionsModel, this, m_snapshot_path); |
390 | 397 | window->setClientModel(clientModel, &tip_info); |
391 | 398 |
|
392 | 399 | // If '-min' option passed, start window minimized (iconified) or minimized to tray |
@@ -580,8 +587,9 @@ int GuiMain(int argc, char* argv[]) |
580 | 587 | // User language is set up: pick a data directory |
581 | 588 | bool did_show_intro = false; |
582 | 589 | int64_t prune_MiB = 0; // Intro dialog prune configuration |
| 590 | + QString snapshot_path; // Intro dialog snapshot path |
583 | 591 | // Gracefully exit if the user cancels |
584 | | - if (!Intro::showIfNeeded(did_show_intro, prune_MiB)) return EXIT_SUCCESS; |
| 592 | + if (!Intro::showIfNeeded(did_show_intro, prune_MiB, snapshot_path)) return EXIT_SUCCESS; |
585 | 593 |
|
586 | 594 | /// 6-7. Parse bitcoin.conf, determine network, switch to network specific |
587 | 595 | /// options, and create datadir and settings.json. |
@@ -662,6 +670,11 @@ int GuiMain(int argc, char* argv[]) |
662 | 670 | app.InitPruneSetting(prune_MiB); |
663 | 671 | } |
664 | 672 |
|
| 673 | + // Store snapshot path for later loading after node initialization |
| 674 | + if (!snapshot_path.isEmpty()) { |
| 675 | + app.setSnapshotPath(snapshot_path); |
| 676 | + } |
| 677 | + |
665 | 678 | try |
666 | 679 | { |
667 | 680 | app.createWindow(networkStyle.data()); |
|
0 commit comments