From d6ca0389c9954d083e301da7bf471e34b674d8be Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sat, 16 Jun 2012 12:18:02 -0700 Subject: [PATCH] Make UNL bootstrapping more robust. --- src/Application.cpp | 7 +++++-- src/UniqueNodeList.cpp | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index d451e91645..9e4cdd5ec8 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -70,6 +70,11 @@ void Application::run() // mWallet.start(); + // + // Set up UNL. + // + getUNL().nodeBootstrap(); + // // Allow peer connections. // @@ -122,8 +127,6 @@ void Application::run() mNetOps.setStateTimer(0); - getUNL().nodeBootstrap(); - mIOService.run(); // This blocks std::cout << "Done." << std::endl; diff --git a/src/UniqueNodeList.cpp b/src/UniqueNodeList.cpp index e52b4e5041..6e10d93ed2 100644 --- a/src/UniqueNodeList.cpp +++ b/src/UniqueNodeList.cpp @@ -1503,10 +1503,10 @@ void UniqueNodeList::nodeBootstrap() ScopedLock sl(theApp->getWalletDB()->getDBLock()); - if (db->executeSQL("SELECT COUNT(*) AS Count FROM SeedDomains;") && db->startIterRows()) + if (db->executeSQL(str(boost::format("SELECT COUNT(*) AS Count FROM SeedDomains WHERE Source='%s' OR Source='%c';") % vsManual % vsValidator)) && db->startIterRows()) iDomains = db->getInt("Count"); - if (db->executeSQL("SELECT COUNT(*) AS Count FROM SeedNodes;") && db->startIterRows()) + if (db->executeSQL(str(boost::format("SELECT COUNT(*) AS Count FROM SeedNodes WHERE Source='%s' OR Source='%c';") % vsManual % vsValidator)) && db->startIterRows()) iNodes = db->getInt("Count"); }