Wallet Repair Buttons added

This commit is contained in:
crowning- 2015-05-25 22:59:38 +02:00
parent 9a6fe03974
commit 3ab747d8ff
4 changed files with 21 additions and 19 deletions

View File

@ -146,8 +146,7 @@ static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
/** Preparing steps before restarting the wallet */
void Prepare_Restart()
{
printf("Prepare_Restart called! ---------------------------\n");
LogPrintf("%s: In progress...\n", __func__);
LogPrintf("%s: In progress...\n", __func__);
static CCriticalSection cs_Shutdown;
TRY_LOCK(cs_Shutdown, lockShutdown);
if (!lockShutdown)

View File

@ -1739,11 +1739,13 @@ public:
}
instance_of_cnetcleanup;
void CExplicitNetCleanup::callCleanup()
{
// Explicit call to destructor of CNetCleanup because it's not implicitly called
// when the wallet is restarted from within the wallet itself.
CNetCleanup *tmp = new CNetCleanup();
delete tmp; // Stroustrup's gonna kill me for that
}
void RelayTransaction(const CTransaction& tx)
{

View File

@ -672,7 +672,11 @@ public:
static uint64_t GetTotalBytesSent();
};
class CExplicitNetCleanup
{
public:
static void callCleanup();
};
class CTransaction;
void RelayTransaction(const CTransaction& tx);

View File

@ -13,6 +13,7 @@
#include "guiconstants.h"
#include "guiutil.h"
#include "intro.h"
#include "net.h"
#include "networkstyle.h"
#include "optionsmodel.h"
#include "splashscreen.h"
@ -280,25 +281,22 @@ void BitcoinCore::initialize()
}
}
void BitcoinCore::restart(QStringList args) // ToDo
{
printf("restart in dash.cpp -------------------------------------------\n");
for (int i = 0; i < args.size(); ++i){
printf("%s\n", args.at(i).toStdString().c_str());
}
void BitcoinCore::restart(QStringList args)
{
try
{
qDebug() << __func__ << ": Running Restart in thread";
threadGroup.interrupt_all();
threadGroup.join_all();
// Shutdown();
Prepare_Restart();
qDebug() << __func__ << ": Shutdown finished";
emit shutdownResult(1);
boost::this_thread::sleep( boost::posix_time::seconds(1) );
CExplicitNetCleanup::callCleanup();
boost::this_thread::sleep( boost::posix_time::seconds(1));
QProcess::startDetached(QApplication::applicationFilePath(), args);
QCoreApplication::quit();
qDebug() << __func__ << ": Restart initiated...";
QCoreApplication::quit();
} catch (std::exception& e) {
handleRunawayException(&e);
} catch (...) {
@ -308,7 +306,6 @@ void BitcoinCore::restart(QStringList args) // ToDo
void BitcoinCore::shutdown()
{
printf("shutdown in dash.cpp -------------------------------------------\n");
try
{
qDebug() << __func__ << ": Running Shutdown in thread";