// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include "txdb.h"
+#include "db.h"
#include "walletdb.h"
#include "bitcoinrpc.h"
#include "net.h"
#endif
}
+static CCoinsViewDB *pcoinsdbview;
+
void Shutdown(void* parg)
{
static CCriticalSection cs_Shutdown;
{
fShutdown = true;
nTransactionsUpdated++;
-// CTxDB().Close();
bitdb.Flush(false);
StopNode();
+ {
+ LOCK(cs_main);
+ pcoinsTip->Flush();
+ pblocktree->Flush();
+ delete pcoinsTip;
+ delete pcoinsdbview;
+ }
bitdb.Flush(true);
boost::filesystem::remove(GetPidFile());
UnregisterWallet(pwalletMain);
return InitError(msg);
}
- if (GetBoolArg("-loadblockindextest"))
- {
- CTxDB txdb("r");
- txdb.LoadBlockIndex();
- PrintBlockTree();
- return false;
- }
-
uiInterface.InitMessage(_("Loading block index..."));
printf("Loading block index...\n");
nStart = GetTimeMillis();
+ pblocktree = new CBlockTreeDB("cr+");
+ pcoinsdbview = new CCoinsViewDB();
+ pcoinsTip = new CCoinsViewCache(*pcoinsdbview);
+
if (!LoadBlockIndex())
return InitError(_("Error loading blkindex.dat"));
-
// as LoadBlockIndex can take several minutes, it's possible the user
// requested to kill bitcoin-qt during the last operation. If so, exit.
// As the program has not fully started yet, Shutdown() is possibly overkill.
// ********************************************************* Step 9: import blocks
+ // scan for better chains in the block chain database, that are not yet connected in the active best chain
+ uiInterface.InitMessage(_("Importing blocks from block database..."));
+ if (!ConnectBestBlock())
+ strErrors << "Failed to connect best block";
+
if (mapArgs.count("-loadblock"))
{
uiInterface.InitMessage(_("Importing blockchain data file."));