Skip to content

Commit 083e790

Browse files
mxaddictalex v
authored andcommitted
Added new -allindex option (#546)
* Added new -allindex option * Added help text for allindex
1 parent f7b1c63 commit 083e790

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ std::string HelpMessage(HelpMessageMode mode)
403403
#ifndef WIN32
404404
strUsage += HelpMessageOpt("-sysperms", _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)"));
405405
#endif
406+
strUsage += HelpMessageOpt("-allindex", strprintf(_("Maintain all indexes supported (default: %u)"), false));
406407
strUsage += HelpMessageOpt("-txindex", strprintf(_("Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)"), DEFAULT_TXINDEX));
407408

408409
strUsage += HelpMessageOpt("-addressindex", strprintf(_("Maintain a full address index, used to query for the balance, txids and unspent outputs for addresses (default: %u)"), DEFAULT_ADDRESSINDEX));

src/main.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5579,23 +5579,31 @@ bool InitBlockIndex(const CChainParams& chainparams)
55795579
if (chainActive.Genesis() != nullptr)
55805580
return true;
55815581

5582-
// Use the provided setting for -txindex in the new database
5582+
// Load the flag values | use DEFAULT_* values if not set
55835583
fTxIndex = GetBoolArg("-txindex", DEFAULT_TXINDEX);
5584+
fAddressIndex = GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX);
5585+
fTimestampIndex = GetBoolArg("-timestampindex", DEFAULT_TIMESTAMPINDEX);
5586+
fSpentIndex = GetBoolArg("-spentindex", DEFAULT_SPENTINDEX);
5587+
5588+
// Check if we want all indexes
5589+
if (GetBoolArg("-allindex", false))
5590+
{
5591+
fTxIndex = fAddressIndex = fTimestampIndex = fSpentIndex = true;
5592+
}
5593+
5594+
// Use the provided setting for -txindex in the new database
55845595
pblocktree->WriteFlag("txindex", fTxIndex);
55855596
LogPrintf("%s: transaction index %s\n", __func__, fTxIndex ? "enabled" : "disabled");
55865597

55875598
// Use the provided setting for -addressindex in the new database
5588-
fAddressIndex = GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX);
55895599
pblocktree->WriteFlag("addressindex", fAddressIndex);
55905600
LogPrintf("%s: address index %s\n", __func__, fAddressIndex ? "enabled" : "disabled");
55915601

55925602
// Use the provided setting for -timestampindex in the new database
5593-
fTimestampIndex = GetBoolArg("-timestampindex", DEFAULT_TIMESTAMPINDEX);
55945603
pblocktree->WriteFlag("timestampindex", fTimestampIndex);
55955604
LogPrintf("%s: timestamp index %s\n", __func__, fTimestampIndex ? "enabled" : "disabled");
55965605

55975606
// Use the provided setting for -spentindex in the new database
5598-
fSpentIndex = GetBoolArg("-spentindex", DEFAULT_SPENTINDEX);
55995607
pblocktree->WriteFlag("spentindex", fSpentIndex);
56005608
LogPrintf("%s: spent index %s\n", __func__, fSpentIndex ? "enabled" : "disabled");
56015609

0 commit comments

Comments
 (0)