|
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"; |
@@ -388,10 +395,10 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead |
388 | 395 | delete m_splash; |
389 | 396 | m_splash = nullptr; |
390 | 397 |
|
391 | | - // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete |
392 | | - qInfo() << "Platform customization:" << platformStyle->getName(); |
393 | | - clientModel = new ClientModel(node(), optionsModel); |
394 | | - window->setClientModel(clientModel, &tip_info); |
| 398 | + // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete |
| 399 | + qInfo() << "Platform customization:" << platformStyle->getName(); |
| 400 | + clientModel = new ClientModel(node(), optionsModel, this, m_snapshot_path); |
| 401 | + window->setClientModel(clientModel, &tip_info); |
395 | 402 |
|
396 | 403 | // If '-min' option passed, start window minimized (iconified) or minimized to tray |
397 | 404 | bool start_minimized = gArgs.GetBoolArg("-min", false); |
@@ -576,8 +583,9 @@ int GuiMain(int argc, char* argv[]) |
576 | 583 | // User language is set up: pick a data directory |
577 | 584 | bool did_show_intro = false; |
578 | 585 | int64_t prune_MiB = 0; // Intro dialog prune configuration |
| 586 | + QString snapshot_path; // Intro dialog snapshot path |
579 | 587 | // Gracefully exit if the user cancels |
580 | | - if (!Intro::showIfNeeded(did_show_intro, prune_MiB)) return EXIT_SUCCESS; |
| 588 | + if (!Intro::showIfNeeded(did_show_intro, prune_MiB, snapshot_path)) return EXIT_SUCCESS; |
581 | 589 |
|
582 | 590 | /// 6-7. Parse bitcoin.conf, determine network, switch to network specific |
583 | 591 | /// options, and create datadir and settings.json. |
@@ -658,6 +666,11 @@ int GuiMain(int argc, char* argv[]) |
658 | 666 | app.InitPruneSetting(prune_MiB); |
659 | 667 | } |
660 | 668 |
|
| 669 | + // Store snapshot path for later loading after node initialization |
| 670 | + if (!snapshot_path.isEmpty()) { |
| 671 | + app.setSnapshotPath(snapshot_path); |
| 672 | + } |
| 673 | + |
661 | 674 | try |
662 | 675 | { |
663 | 676 | app.createWindow(networkStyle.data()); |
|
0 commit comments