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) @@ -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))) {

13
src/main.cpp

@ -45,7 +45,7 @@ int nScriptCheckThreads = 0; @@ -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 @@ -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() @@ -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() { @@ -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");

1
src/main.h

@ -96,7 +96,6 @@ extern bool fImporting; @@ -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;

Loading…
Cancel
Save