diff --git a/src/clientversion.h b/src/clientversion.h index ea0510e..c3c516d 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -8,7 +8,7 @@ // These need to be macros, as version.cpp's and triangles-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 5 #define CLIENT_VERSION_MINOR 5 -#define CLIENT_VERSION_REVISION 4 +#define CLIENT_VERSION_REVISION 5 #define CLIENT_VERSION_BUILD 0 // Converts the parameter X to a string after macro replacement on X has been performed. diff --git a/src/init.cpp b/src/init.cpp index 5d98261..496e78c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -834,8 +834,22 @@ bool AppInit2() StartupPerfLog("network_init", GetTimeMillis() - nStart, strprintf("listen=%d seednodes=%" PRIszu, !fNoListen, mapMultiArgs["-seednode"].size())); // ********************************************************* Step 6b: bootstrap download (daemon) + // Automatic: if data dir has no blockchain, bootstrap without asking. + // Can also be forced with -bootstrap flag, or disabled with -nobootstrap. #ifndef QT_GUI - if (GetBoolArg("-bootstrap", false)) + { + bool wantsBootstrap = GetBoolArg("-bootstrap", false); + bool noBootstrap = GetBoolArg("-nobootstrap", false); + fs::path dataPath = GetDataDir(); + bool needsBootstrap = Bootstrap::NeedsBootstrap(dataPath); + + if (needsBootstrap && !noBootstrap) { + printf("Bootstrap: no blockchain data found — downloading automatically.\n"); + printf("Bootstrap: (use -nobootstrap to skip)\n"); + wantsBootstrap = true; + } + + if (wantsBootstrap) { int64_t nBootstrapStart = GetTimeMillis(); fs::path dataPath = GetDataDir(); @@ -871,6 +885,7 @@ bool AppInit2() StartupPerfLog("bootstrap_download", GetTimeMillis() - nBootstrapStart, strprintf("host=%s success=%d", host.c_str(), success)); } + } // end bootstrap scope #endif // ********************************************************* Step 7: load blockchain diff --git a/src/qt/introdialog.cpp b/src/qt/introdialog.cpp index 13984d2..81ae9d9 100644 --- a/src/qt/introdialog.cpp +++ b/src/qt/introdialog.cpp @@ -225,9 +225,22 @@ bool IntroDialog::pickDataDirectory() return false; } - // Offer bootstrap download on each startup (unless user checked "don't ask again") + // Auto-bootstrap: if no blockchain data exists, download automatically. + // If data exists, offer optional re-download (unless user checked "don't ask again"). fs::path dataDirPath(dataDir.toStdString()); - if (!settings.value("bootstrapDontAsk", false).toBool()) + bool needsBootstrap = Bootstrap::NeedsBootstrap(dataDirPath); + bool userWantsBootstrap = false; + + if (needsBootstrap) + { + // No blockchain data — bootstrap automatically, just inform the user + QMessageBox::information(0, "Triangles", + "No blockchain data found.\n\n" + "Downloading the latest blockchain snapshot automatically.\n" + "This will only take a few minutes."); + userWantsBootstrap = true; + } + else if (!settings.value("bootstrapDontAsk", false).toBool()) { QMessageBox msgBox; msgBox.setWindowTitle("Triangles"); @@ -247,7 +260,10 @@ bool IntroDialog::pickDataDirectory() if (dontAskBox->isChecked()) settings.setValue("bootstrapDontAsk", true); - if (ret == QMessageBox::Yes) + userWantsBootstrap = (ret == QMessageBox::Yes); + } + + if (userWantsBootstrap) { std::string host = Bootstrap::DEFAULT_HOST; std::string strError;