fTxIndex always true in twister

This commit is contained in:
Miguel Freitas 2013-07-18 18:42:22 -03:00
parent 16a28fc9e9
commit b0716cdc3d
3 changed files with 8 additions and 12 deletions

View File

@ -718,12 +718,6 @@ bool AppInit2(boost::thread_group& threadGroup)
break;
}
// Check for changed -txindex state
if (fTxIndex != GetBoolArg("-txindex", false)) {
strLoadError = _("You need to rebuild the database using -reindex to change -txindex");
break;
}
uiInterface.InitMessage(_("Verifying blocks..."));
if (!VerifyDB(GetArg("-checklevel", 3),
GetArg( "-checkblocks", 288))) {

View File

@ -45,7 +45,7 @@ int nScriptCheckThreads = 0;
bool fImporting = false;
bool fReindex = false;
bool fBenchmark = false;
bool fTxIndex = false;
bool fTxIndex = true; // always true in twister
unsigned int nCoinCacheSize = 5000;
bool fHaveGUI = false;
@ -1347,9 +1347,10 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
return state.Abort(_("Failed to write block index"));
}
if (fTxIndex)
if (fTxIndex) {
if (!pblocktree->WriteTxIndex(vPos))
return state.Abort(_("Failed to write transaction index"));
}
// add this block to the view's block chain
assert(view.SetBestBlock(pindex));
@ -2180,8 +2181,10 @@ bool static LoadBlockIndexDB()
fReindex |= fReindexing;
// Check whether we have a transaction index
pblocktree->ReadFlag("txindex", fTxIndex);
printf("LoadBlockIndexDB(): transaction index %s\n", fTxIndex ? "enabled" : "disabled");
bool readTxIndex;
pblocktree->ReadFlag("txindex", readTxIndex);
printf("LoadBlockIndexDB(): transaction index %s\n", readTxIndex ? "enabled" : "disabled");
assert( readTxIndex ); // always true in twister
// Load hashBestChain pointer to end of best chain
pindexBest = pcoinsTip->GetBestBlock();
@ -2305,7 +2308,7 @@ bool InitBlockIndex() {
return true;
// Use the provided setting for -txindex in the new database
fTxIndex = GetBoolArg("-txindex", false);
fTxIndex = true;
pblocktree->WriteFlag("txindex", fTxIndex);
printf("Initializing databases...\n");

View File

@ -96,7 +96,6 @@ extern bool fImporting;
extern bool fReindex;
extern bool fBenchmark;
extern int nScriptCheckThreads;
extern bool fTxIndex;
extern unsigned int nCoinCacheSize;
extern bool fHaveGUI;