aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorAdam Weiss <adam@signal11.com>2015-06-30 13:22:48 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2015-09-22 00:43:12 +0000
commite6adac7b3f971f04f883211d2c1f385c55d6718b (patch)
treee9cb4071f5c7d4bd290009e209aaac6af309e6d4 /src/init.cpp
parente0020d4c44039b50564a0539af028fa18efe5b63 (diff)
downloadbitcoin-e6adac7b3f971f04f883211d2c1f385c55d6718b.tar.xz
Delay initial pruning until after wallet init
Don't prune until any wallet rescanning has taken place to avoid potentially pruning blocks that the wallet rescan may need.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/init.cpp b/src/init.cpp
index d127d55d7c..e352d58ec4 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1223,15 +1223,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
mempool.ReadFeeEstimates(est_filein);
fFeeEstimatesInitialized = true;
- // if prune mode, unset NODE_NETWORK and prune block files
- if (fPruneMode) {
- LogPrintf("Unsetting NODE_NETWORK on prune mode\n");
- nLocalServices &= ~NODE_NETWORK;
- if (!fReindex) {
- PruneAndFlush();
- }
- }
-
// ********************************************************* Step 8: load wallet
#ifdef ENABLE_WALLET
if (fDisableWallet) {
@@ -1372,7 +1363,21 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
#else // ENABLE_WALLET
LogPrintf("No wallet support compiled in!\n");
#endif // !ENABLE_WALLET
- // ********************************************************* Step 9: import blocks
+
+ // ********************************************************* Step 9: data directory maintenance
+
+ // if pruning, unset the service bit and perform the initial blockstore prune
+ // after any wallet rescanning has taken place.
+ if (fPruneMode) {
+ uiInterface.InitMessage(_("Pruning blockstore..."));
+ LogPrintf("Unsetting NODE_NETWORK on prune mode\n");
+ nLocalServices &= ~NODE_NETWORK;
+ if (!fReindex) {
+ PruneAndFlush();
+ }
+ }
+
+ // ********************************************************* Step 10: import blocks
if (mapArgs.count("-blocknotify"))
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback);
@@ -1396,7 +1401,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
MilliSleep(10);
}
- // ********************************************************* Step 10: start node
+ // ********************************************************* Step 11: start node
if (!CheckDiskSpace())
return false;