Define -zindex
This commit is contained in:
21
src/chain.h
21
src/chain.h
@@ -29,6 +29,7 @@ class CChainPower;
|
|||||||
#include "tinyformat.h"
|
#include "tinyformat.h"
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
extern int8_t is_STAKED(const char *chain_name);
|
extern int8_t is_STAKED(const char *chain_name);
|
||||||
|
extern bool fZindex;
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -614,15 +615,19 @@ public:
|
|||||||
READWRITE(VARINT(nStatus));
|
READWRITE(VARINT(nStatus));
|
||||||
READWRITE(VARINT(nTx));
|
READWRITE(VARINT(nTx));
|
||||||
|
|
||||||
READWRITE(VARINT(nShieldedTx));
|
// These values only serialized when -zindex=1
|
||||||
READWRITE(VARINT(nShieldingTx));
|
//if (fZindex != GetBoolArg("-zindex", false)) {
|
||||||
READWRITE(VARINT(nDeshieldingTx));
|
if(fZindex) {
|
||||||
READWRITE(VARINT(nFullyShieldedTx));
|
READWRITE(VARINT(nShieldedTx));
|
||||||
|
READWRITE(VARINT(nShieldingTx));
|
||||||
|
READWRITE(VARINT(nDeshieldingTx));
|
||||||
|
READWRITE(VARINT(nFullyShieldedTx));
|
||||||
|
|
||||||
READWRITE(VARINT(nShieldedPayments));
|
READWRITE(VARINT(nShieldedPayments));
|
||||||
READWRITE(VARINT(nShieldingPayments));
|
READWRITE(VARINT(nShieldingPayments));
|
||||||
READWRITE(VARINT(nDeshieldingPayments));
|
READWRITE(VARINT(nDeshieldingPayments));
|
||||||
READWRITE(VARINT(nFullyShieldedPayments));
|
READWRITE(VARINT(nFullyShieldedPayments));
|
||||||
|
}
|
||||||
|
|
||||||
if (nStatus & (BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO))
|
if (nStatus & (BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO))
|
||||||
READWRITE(VARINT(nFile));
|
READWRITE(VARINT(nFile));
|
||||||
|
|||||||
@@ -1668,6 +1668,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for changed -zindex state
|
||||||
|
if (fZindex != GetBoolArg("-zindex", false)) {
|
||||||
|
strLoadError = _("You need to rebuild the database using -reindex to change -zindex");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for changed -prune state. What we are concerned about is a user who has pruned blocks
|
// Check for changed -prune state. What we are concerned about is a user who has pruned blocks
|
||||||
// in the past, but is now trying to run unpruned.
|
// in the past, but is now trying to run unpruned.
|
||||||
if (fHavePruned && !fPruneMode) {
|
if (fHavePruned && !fPruneMode) {
|
||||||
|
|||||||
11
src/main.cpp
11
src/main.cpp
@@ -98,6 +98,7 @@ bool fExperimentalMode = true;
|
|||||||
bool fImporting = false;
|
bool fImporting = false;
|
||||||
bool fReindex = false;
|
bool fReindex = false;
|
||||||
bool fTxIndex = false;
|
bool fTxIndex = false;
|
||||||
|
bool fZindex = false;
|
||||||
bool fAddressIndex = false;
|
bool fAddressIndex = false;
|
||||||
bool fTimestampIndex = false;
|
bool fTimestampIndex = false;
|
||||||
bool fSpentIndex = false;
|
bool fSpentIndex = false;
|
||||||
@@ -6279,6 +6280,9 @@ bool static LoadBlockIndexDB()
|
|||||||
// Check whether we have an address index
|
// Check whether we have an address index
|
||||||
pblocktree->ReadFlag("addressindex", fAddressIndex);
|
pblocktree->ReadFlag("addressindex", fAddressIndex);
|
||||||
LogPrintf("%s: address index %s\n", __func__, fAddressIndex ? "enabled" : "disabled");
|
LogPrintf("%s: address index %s\n", __func__, fAddressIndex ? "enabled" : "disabled");
|
||||||
|
// Check whether we have a shielded index
|
||||||
|
pblocktree->ReadFlag("zindex", fZindex);
|
||||||
|
LogPrintf("%s: shielded index %s\n", __func__, fZindex ? "enabled" : "disabled");
|
||||||
|
|
||||||
// Check whether we have a timestamp index
|
// Check whether we have a timestamp index
|
||||||
pblocktree->ReadFlag("timestampindex", fTimestampIndex);
|
pblocktree->ReadFlag("timestampindex", fTimestampIndex);
|
||||||
@@ -6643,17 +6647,22 @@ bool InitBlockIndex() {
|
|||||||
// Use the provided setting for -txindex in the new database
|
// Use the provided setting for -txindex in the new database
|
||||||
fTxIndex = GetBoolArg("-txindex", true);
|
fTxIndex = GetBoolArg("-txindex", true);
|
||||||
pblocktree->WriteFlag("txindex", fTxIndex);
|
pblocktree->WriteFlag("txindex", fTxIndex);
|
||||||
|
|
||||||
// Use the provided setting for -addressindex in the new database
|
// Use the provided setting for -addressindex in the new database
|
||||||
fAddressIndex = GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX);
|
fAddressIndex = GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX);
|
||||||
pblocktree->WriteFlag("addressindex", fAddressIndex);
|
pblocktree->WriteFlag("addressindex", fAddressIndex);
|
||||||
|
|
||||||
|
// Use the provided setting for -zindex in the new database
|
||||||
|
fAddressIndex = GetBoolArg("-zindex", DEFAULT_SHIELDEDINDEX);
|
||||||
|
pblocktree->WriteFlag("zindex", fZindex);
|
||||||
|
|
||||||
// Use the provided setting for -timestampindex in the new database
|
// Use the provided setting for -timestampindex in the new database
|
||||||
fTimestampIndex = GetBoolArg("-timestampindex", DEFAULT_TIMESTAMPINDEX);
|
fTimestampIndex = GetBoolArg("-timestampindex", DEFAULT_TIMESTAMPINDEX);
|
||||||
pblocktree->WriteFlag("timestampindex", fTimestampIndex);
|
pblocktree->WriteFlag("timestampindex", fTimestampIndex);
|
||||||
|
|
||||||
fSpentIndex = GetBoolArg("-spentindex", DEFAULT_SPENTINDEX);
|
fSpentIndex = GetBoolArg("-spentindex", DEFAULT_SPENTINDEX);
|
||||||
pblocktree->WriteFlag("spentindex", fSpentIndex);
|
pblocktree->WriteFlag("spentindex", fSpentIndex);
|
||||||
fprintf(stderr,"fAddressIndex.%d/%d fSpentIndex.%d/%d\n",fAddressIndex,DEFAULT_ADDRESSINDEX,fSpentIndex,DEFAULT_SPENTINDEX);
|
fprintf(stderr,"fAddressIndex.%d/%d fSpentIndex.%d/%d fZindex.%d/%d\n",fAddressIndex,DEFAULT_ADDRESSINDEX,fSpentIndex,DEFAULT_SPENTINDEX,fZindex, DEFAULT_SHIELDEDINDEX );
|
||||||
LogPrintf("Initializing databases...\n");
|
LogPrintf("Initializing databases...\n");
|
||||||
}
|
}
|
||||||
// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
|
// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60;
|
|||||||
#define DEFAULT_ADDRESSINDEX (GetArg("-ac_cc",0) != 0 || GetArg("-ac_ccactivate",0) != 0)
|
#define DEFAULT_ADDRESSINDEX (GetArg("-ac_cc",0) != 0 || GetArg("-ac_ccactivate",0) != 0)
|
||||||
#define DEFAULT_SPENTINDEX (GetArg("-ac_cc",0) != 0 || GetArg("-ac_ccactivate",0) != 0)
|
#define DEFAULT_SPENTINDEX (GetArg("-ac_cc",0) != 0 || GetArg("-ac_ccactivate",0) != 0)
|
||||||
static const bool DEFAULT_TIMESTAMPINDEX = false;
|
static const bool DEFAULT_TIMESTAMPINDEX = false;
|
||||||
|
static const bool DEFAULT_SHIELDEDINDEX = false;
|
||||||
static const unsigned int DEFAULT_DB_MAX_OPEN_FILES = 1000;
|
static const unsigned int DEFAULT_DB_MAX_OPEN_FILES = 1000;
|
||||||
static const bool DEFAULT_DB_COMPRESSION = true;
|
static const bool DEFAULT_DB_COMPRESSION = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user