Move tx estimation data out of CCheckPointData
This commit is contained in:
parent
a4bac66cca
commit
3641141c8f
7 changed files with 28 additions and 13 deletions
|
@ -151,7 +151,10 @@ public:
|
|||
(225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))
|
||||
(250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214"))
|
||||
(279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40"))
|
||||
(295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")),
|
||||
(295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983"))
|
||||
};
|
||||
|
||||
chainTxData = ChainTxData{
|
||||
1397080064, // * UNIX timestamp of last checkpoint block
|
||||
36544669, // * total number of transactions between genesis and last checkpoint
|
||||
// (the tx=... number in the SetBestChain debug.log lines)
|
||||
|
@ -234,6 +237,9 @@ public:
|
|||
checkpointData = (CCheckpointData) {
|
||||
boost::assign::map_list_of
|
||||
( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")),
|
||||
};
|
||||
|
||||
chainTxData = ChainTxData{
|
||||
1337966069,
|
||||
1488,
|
||||
300
|
||||
|
@ -297,11 +303,15 @@ public:
|
|||
|
||||
checkpointData = (CCheckpointData){
|
||||
boost::assign::map_list_of
|
||||
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")),
|
||||
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"))
|
||||
};
|
||||
|
||||
chainTxData = ChainTxData{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
|
||||
|
|
|
@ -28,6 +28,9 @@ typedef std::map<int, uint256> MapCheckpoints;
|
|||
|
||||
struct CCheckpointData {
|
||||
MapCheckpoints mapCheckpoints;
|
||||
};
|
||||
|
||||
struct ChainTxData {
|
||||
int64_t nTimeLastCheckpoint;
|
||||
int64_t nTransactionsLastCheckpoint;
|
||||
double fTransactionsPerDay;
|
||||
|
@ -73,6 +76,7 @@ public:
|
|||
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
|
||||
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
|
||||
const CCheckpointData& Checkpoints() const { return checkpointData; }
|
||||
const ChainTxData& TxData() const { return chainTxData; }
|
||||
protected:
|
||||
CChainParams() {}
|
||||
|
||||
|
@ -90,6 +94,7 @@ protected:
|
|||
bool fRequireStandard;
|
||||
bool fMineBlocksOnDemand;
|
||||
CCheckpointData checkpointData;
|
||||
ChainTxData chainTxData;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -130,7 +130,7 @@ double ClientModel::getVerificationProgress(const CBlockIndex *tipIn) const
|
|||
LOCK(cs_main);
|
||||
tip = chainActive.Tip();
|
||||
}
|
||||
return GuessVerificationProgress(Params().Checkpoints(), tip);
|
||||
return GuessVerificationProgress(Params().TxData(), tip);
|
||||
}
|
||||
|
||||
void ClientModel::updateTimer()
|
||||
|
|
|
@ -1073,7 +1073,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
|||
obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast()));
|
||||
obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip())));
|
||||
obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip())));
|
||||
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
|
||||
obj.push_back(Pair("pruned", fPruneMode));
|
||||
|
||||
|
|
|
@ -2080,7 +2080,7 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) {
|
|||
chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), chainActive.Tip()->nVersion,
|
||||
log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), (unsigned long)chainActive.Tip()->nChainTx,
|
||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()),
|
||||
GuessVerificationProgress(chainParams.Checkpoints(), chainActive.Tip()), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize());
|
||||
GuessVerificationProgress(chainParams.TxData(), chainActive.Tip()), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize());
|
||||
if (!warningMessages.empty())
|
||||
LogPrintf(" warning='%s'", boost::algorithm::join(warningMessages, ", "));
|
||||
LogPrintf("\n");
|
||||
|
@ -3445,7 +3445,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
|
|||
LogPrintf("%s: hashBestChain=%s height=%d date=%s progress=%f\n", __func__,
|
||||
chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(),
|
||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()),
|
||||
GuessVerificationProgress(chainparams.Checkpoints(), chainActive.Tip()));
|
||||
GuessVerificationProgress(chainparams.TxData(), chainActive.Tip()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -4152,7 +4152,7 @@ void DumpMempool(void)
|
|||
static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
|
||||
|
||||
//! Guess how far we are in the verification process at the given block index
|
||||
double GuessVerificationProgress(const CCheckpointData& data, CBlockIndex *pindex, bool fSigchecks) {
|
||||
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex *pindex, bool fSigchecks) {
|
||||
if (pindex==NULL)
|
||||
return 0.0;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class CScriptCheck;
|
|||
class CTxMemPool;
|
||||
class CValidationInterface;
|
||||
class CValidationState;
|
||||
class CCheckpointData;
|
||||
struct ChainTxData;
|
||||
|
||||
struct PrecomputedTransactionData;
|
||||
struct LockPoints;
|
||||
|
@ -281,7 +281,7 @@ bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams,
|
|||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
||||
|
||||
/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
|
||||
double GuessVerificationProgress(const CCheckpointData& data, CBlockIndex* pindex, bool fSigchecks = true);
|
||||
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex* pindex, bool fSigchecks = true);
|
||||
|
||||
/**
|
||||
* Prune block and undo files (blk???.dat and undo???.dat) so that the disk space used is less than a user-defined target.
|
||||
|
|
|
@ -1479,12 +1479,12 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
|||
pindex = chainActive.Next(pindex);
|
||||
|
||||
ShowProgress(_("Rescanning..."), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
|
||||
double dProgressStart = GuessVerificationProgress(chainParams.Checkpoints(), pindex, false);
|
||||
double dProgressTip = GuessVerificationProgress(chainParams.Checkpoints(), chainActive.Tip(), false);
|
||||
double dProgressStart = GuessVerificationProgress(chainParams.TxData(), pindex, false);
|
||||
double dProgressTip = GuessVerificationProgress(chainParams.TxData(), chainActive.Tip(), false);
|
||||
while (pindex)
|
||||
{
|
||||
if (pindex->nHeight % 100 == 0 && dProgressTip - dProgressStart > 0.0)
|
||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.Checkpoints(), pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.TxData(), pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
||||
|
||||
CBlock block;
|
||||
ReadBlockFromDisk(block, pindex, Params().GetConsensus());
|
||||
|
@ -1497,7 +1497,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
|||
pindex = chainActive.Next(pindex);
|
||||
if (GetTime() >= nNow + 60) {
|
||||
nNow = GetTime();
|
||||
LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->nHeight, GuessVerificationProgress(chainParams.Checkpoints(), pindex));
|
||||
LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->nHeight, GuessVerificationProgress(chainParams.TxData(), pindex));
|
||||
}
|
||||
}
|
||||
ShowProgress(_("Rescanning..."), 100); // hide progress dialog in GUI
|
||||
|
|
Loading…
Reference in a new issue