aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorBrandon Dahler <brandon.dahler@gmail.com>2013-04-13 00:13:08 -0500
committerBrandon Dahler <brandon.dahler@gmail.com>2013-11-10 09:36:28 -0600
commit51ed9ec971614aebdbfbd9527aba365dd0afd437 (patch)
treed2f910390e55aef857023812fbdaefdd66cd99ff /src/init.cpp
parent7c4c207be8420d394a5abc4368d1bb69ad4f8067 (diff)
Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 80ba65f807..6749064ed5 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -8,29 +8,30 @@
#endif
#include "init.h"
-#include "main.h"
-#include "core.h"
-#include "chainparams.h"
-#include "txdb.h"
-#include "walletdb.h"
+
+#include "addrman.h"
#include "bitcoinrpc.h"
-#include "net.h"
-#include "util.h"
+#include "checkpoints.h"
#include "miner.h"
+#include "net.h"
+#include "txdb.h"
#include "ui_interface.h"
-#include "checkpoints.h"
+#include "util.h"
+#include "wallet.h"
+#include "walletdb.h"
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-#include <boost/filesystem/convenience.hpp>
-#include <boost/interprocess/sync/file_lock.hpp>
-#include <boost/algorithm/string/predicate.hpp>
-#include <openssl/crypto.h>
+#include <inttypes.h>
+#include <stdint.h>
#ifndef WIN32
#include <signal.h>
#endif
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/interprocess/sync/file_lock.hpp>
+#include <openssl/crypto.h>
+
using namespace std;
using namespace boost;
@@ -520,7 +521,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
// cost to you of processing a transaction.
if (mapArgs.count("-mintxfee"))
{
- int64 n = 0;
+ int64_t n = 0;
if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0)
CTransaction::nMinTxFee = n;
else
@@ -528,7 +529,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
}
if (mapArgs.count("-minrelaytxfee"))
{
- int64 n = 0;
+ int64_t n = 0;
if (ParseMoney(mapArgs["-minrelaytxfee"], n) && n > 0)
CTransaction::nMinRelayTxFee = n;
else
@@ -582,7 +583,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
threadGroup.create_thread(&ThreadScriptCheck);
}
- int64 nStart;
+ int64_t nStart;
// ********************************************************* Step 5: verify wallet database integrity
@@ -592,7 +593,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
{
// try moving the database env out of the way
boost::filesystem::path pathDatabase = GetDataDir() / "database";
- boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%"PRI64d".bak", GetTime());
+ boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%"PRId64".bak", GetTime());
try {
boost::filesystem::rename(pathDatabase, pathDatabaseBak);
LogPrintf("Moved old %s to %s. Retrying.\n", pathDatabase.string().c_str(), pathDatabaseBak.string().c_str());
@@ -864,7 +865,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
LogPrintf("Shutdown requested. Exiting.\n");
return false;
}
- LogPrintf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+ LogPrintf(" block index %15"PRId64"ms\n", GetTimeMillis() - nStart);
if (GetBoolArg("-printblockindex", false) || GetBoolArg("-printblocktree", false))
{
@@ -957,7 +958,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
}
LogPrintf("%s", strErrors.str().c_str());
- LogPrintf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+ LogPrintf(" wallet %15"PRId64"ms\n", GetTimeMillis() - nStart);
RegisterWallet(pwalletMain);
@@ -979,7 +980,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
LogPrintf("Rescanning last %i blocks (from block %i)...\n", chainActive.Height() - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis();
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
- LogPrintf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+ LogPrintf(" rescan %15"PRId64"ms\n", GetTimeMillis() - nStart);
pwalletMain->SetBestChain(chainActive.GetLocator());
nWalletDBUpdated++;
}
@@ -1011,7 +1012,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
LogPrintf("Invalid or missing peers.dat; recreating\n");
}
- LogPrintf("Loaded %i addresses from peers.dat %"PRI64d"ms\n",
+ LogPrintf("Loaded %i addresses from peers.dat %"PRId64"ms\n",
addrman.size(), GetTimeMillis() - nStart);
// ********************************************************* Step 11: start node