Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void Shutdown()
static CCriticalSection cs_Shutdown;
TRY_LOCK(cs_Shutdown, lockShutdown);
if (!lockShutdown) return;

RenameThread("bitcoin-shutoff");
nTransactionsUpdated++;
StopRPCThreads();
Expand Down Expand Up @@ -370,6 +370,7 @@ std::string HelpMessage()
" -zapwallettxes=<mode> " + _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") + "\n" +
" " + _("(default: 1, 1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)") + "\n" +
" -alertnotify=<cmd> " + _("Execute command when a relevant alert is received (%s in cmd is replaced by message)") + "\n" +
" -wallet=<file> " + _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat") + "\n" +
" -upgradewallet " + _("Upgrade wallet to latest format") + "\n" +
" -keypool=<n> " + _("Set key pool size to <n> (default: 100)") + "\n" +
" -rescan " + _("Rescan the block chain for missing wallet transactions") + "\n" +
Expand All @@ -396,7 +397,7 @@ std::string HelpMessage()
"\n" + _("InstantX options:") + "\n" +
" -enableinstantx=<n> " + _("Disable instantx, do not show confirmations for locked transactions (bool, default: false)") + "\n" +
" -instantxdepth=<n> " + _("Show N confirmations for a successfully locked transaciton (0-9999, default: 1)") + "\n" +

"\n" + _("Block creation options:") + "\n" +
" -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n" +
" -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n" +
Expand Down Expand Up @@ -679,10 +680,16 @@ bool AppInit2(boost::thread_group& threadGroup)
return InitError(_("Unable to sign masternode payment winner, wrong key?"));
}

std::string strWalletFile = GetArg("-wallet", "wallet.dat");

// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log

std::string strDataDir = GetDataDir().string();

// Wallet file must be a plain filename without a directory
if (strWalletFile != boost::filesystem::basename(strWalletFile) + boost::filesystem::extension(strWalletFile))
return InitError(strprintf(_("Wallet %s resides outside data directory %s"), strWalletFile.c_str(), strDataDir.c_str()));

// Make sure only a single Bitcoin process is using the data directory.
boost::filesystem::path pathLockFile = GetDataDir() / ".lock";
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
Expand Down Expand Up @@ -746,13 +753,13 @@ bool AppInit2(boost::thread_group& threadGroup)
if (GetBoolArg("-salvagewallet"))
{
// Recover readable keypairs:
if (!CWalletDB::Recover(bitdb, "wallet.dat", true))
if (!CWalletDB::Recover(bitdb, strWalletFile.c_str(), true))
return false;
}

if (filesystem::exists(GetDataDir() / "wallet.dat"))
if (filesystem::exists(GetDataDir() / strWalletFile.c_str()))
{
CDBEnv::VerifyResult r = bitdb.Verify("wallet.dat", CWalletDB::Recover);
CDBEnv::VerifyResult r = bitdb.Verify(strWalletFile.c_str(), CWalletDB::Recover);
if (r == CDBEnv::RECOVER_OK)
{
string msg = strprintf(_("Warning: wallet.dat corrupt, data salvaged!"
Expand Down Expand Up @@ -1052,7 +1059,7 @@ bool AppInit2(boost::thread_group& threadGroup)
if (GetBoolArg("-zapwallettxes", false)) {
uiInterface.InitMessage(_("Zapping all transactions from wallet..."));

pwalletMain = new CWallet("wallet.dat");
pwalletMain = new CWallet(strWalletFile.c_str());
DBErrors nZapWalletRet = pwalletMain->ZapWalletTx(vWtx);
if (nZapWalletRet != DB_LOAD_OK) {
uiInterface.InitMessage(_("Error loading wallet.dat: Wallet corrupted"));
Expand All @@ -1067,7 +1074,7 @@ bool AppInit2(boost::thread_group& threadGroup)

nStart = GetTimeMillis();
bool fFirstRun = true;
pwalletMain = new CWallet("wallet.dat");
pwalletMain = new CWallet(strWalletFile.c_str());
DBErrors nLoadWalletRet = pwalletMain->LoadWallet(fFirstRun);
if (nLoadWalletRet != DB_LOAD_OK)
{
Expand Down Expand Up @@ -1132,7 +1139,7 @@ bool AppInit2(boost::thread_group& threadGroup)
pindexRescan = pindexGenesisBlock;
else
{
CWalletDB walletdb("wallet.dat");
CWalletDB walletdb(strWalletFile.c_str());
CBlockLocator locator;
if (walletdb.ReadBestBlock(locator))
pindexRescan = locator.GetBlockIndex();
Expand Down Expand Up @@ -1213,7 +1220,7 @@ bool AppInit2(boost::thread_group& threadGroup)
strMasterNodePrivKey = GetArg("-masternodeprivkey", "");
if(!strMasterNodePrivKey.empty()){
std::string errorMessage;

CKey key;
CPubKey pubkey;

Expand All @@ -1223,7 +1230,7 @@ bool AppInit2(boost::thread_group& threadGroup)
}

activeMasternode.pubkeyMasterNode2 = pubkey;

} else {
return InitError(_("You must specify a masternodeprivkey in the configuration. Please see documentation for help."));
}
Expand Down
6 changes: 3 additions & 3 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
case Language:
settings.setValue("language", value);
break;
case DarksendRounds:
case DarksendRounds:
nDarksendRounds = value.toInt();
settings.setValue("nDarksendRounds", nDarksendRounds);
emit darksendRoundsChanged(nDarksendRounds);
break;
case AnonymizeDarkcoinAmount:
case AnonymizeDarkcoinAmount:
nAnonymizeDarkcoinAmount = value.toInt();
settings.setValue("nAnonymizeDarkcoinAmount", nAnonymizeDarkcoinAmount);
emit anonymizeDarkcoinAmountChanged(nAnonymizeDarkcoinAmount);
Expand Down Expand Up @@ -325,4 +325,4 @@ qint64 OptionsModel::getTransactionFee()
bool OptionsModel::getCoinControlFeatures()
{
return fCoinControlFeatures;
}
}
8 changes: 4 additions & 4 deletions src/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ void ThreadFlushWalletDB(const string& strFile)
map<string, int>::iterator mi = bitdb.mapFileUseCount.find(strFile);
if (mi != bitdb.mapFileUseCount.end())
{
LogPrintf("Flushing wallet.dat\n");
LogPrintf("Flushing %s\n", strFile.c_str());
nLastFlushed = nWalletDBUpdated;
int64 nStart = GetTimeMillis();

Expand All @@ -621,7 +621,7 @@ void ThreadFlushWalletDB(const string& strFile)
bitdb.CheckpointLSN(strFile);

bitdb.mapFileUseCount.erase(mi++);
LogPrintf("Flushed wallet.dat %"PRI64d"ms\n", GetTimeMillis() - nStart);
LogPrintf("Flushed %s %"PRI64d"ms\n", strFile.c_str(), GetTimeMillis() - nStart);
}
}
}
Expand Down Expand Up @@ -656,10 +656,10 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
#else
filesystem::copy_file(pathSrc, pathDest);
#endif
LogPrintf("copied wallet.dat to %s\n", pathDest.string().c_str());
LogPrintf("copied %s to %s\n", pathSrc.string().c_str(), pathDest.string().c_str());
return true;
} catch(const filesystem::filesystem_error &e) {
LogPrintf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what());
LogPrintf("error copying %s to %s - %s\n", pathSrc.string().c_str(), pathDest.string().c_str(), e.what());
return false;
}
}
Expand Down