Browse Source

fTxIndex always true in twister

miguelfreitas
Miguel Freitas 12 years ago
parent
commit
b0716cdc3d
  1. 6
      src/init.cpp
  2. 13
      src/main.cpp
  3. 1
      src/main.h

6
src/init.cpp

@ -718,12 +718,6 @@ bool AppInit2(boost::thread_group& threadGroup)
break; 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...")); uiInterface.InitMessage(_("Verifying blocks..."));
if (!VerifyDB(GetArg("-checklevel", 3), if (!VerifyDB(GetArg("-checklevel", 3),
GetArg( "-checkblocks", 288))) { GetArg( "-checkblocks", 288))) {

13
src/main.cpp

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

1
src/main.h

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

Loading…
Cancel
Save