diff options
author | Adam Weiss <adam@signal11.com> | 2015-06-30 13:22:48 -0400 |
---|---|---|
committer | Adam Weiss <adam@signal11.com> | 2015-07-29 14:00:25 -0400 |
commit | f0cba6f8ebc2eb5a988f506b37e7113f724e63ff (patch) | |
tree | ff9b8131c05be8aab0272d96005fd2348977df7c | |
parent | da77a6f7611f71443914e1c71df1e52468cf507d (diff) |
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.
-rw-r--r-- | src/init.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/init.cpp b/src/init.cpp index c4e3573de3..6c9c1214f0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1226,15 +1226,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) { @@ -1388,7 +1379,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); @@ -1412,7 +1417,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) MilliSleep(10); } - // ********************************************************* Step 10: start node + // ********************************************************* Step 11: start node if (!CheckDiskSpace()) return false; |