From 3ab7b8dc69bc88ebc7f3540c7188a3fa805e96de Mon Sep 17 00:00:00 2001 From: Brannon King Date: Mon, 16 Sep 2019 14:54:05 -0600 Subject: [PATCH] rolled version, fix txindex_test, other tweaks --- configure.ac | 1 - src/claimtrie.cpp | 2 +- src/dbwrapper.cpp | 4 +++- src/nameclaim.cpp | 7 ++----- src/validation.cpp | 9 ++++----- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 1ffdbb849..cf52ad6a8 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,6 @@ define(_CLIENT_VERSION_MINOR, 19) define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_RC, 1) -define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2019) define(_COPYRIGHT_HOLDERS,[The %s developers]) define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[LBRYcrd Core]]) diff --git a/src/claimtrie.cpp b/src/claimtrie.cpp index 9435610a8..5dd1a18c0 100644 --- a/src/claimtrie.cpp +++ b/src/claimtrie.cpp @@ -640,7 +640,7 @@ bool CClaimTrieCacheBase::ReadFromDisk(const CBlockIndex* tip) clear(); if (tip && base->db->Exists(std::make_pair(TRIE_NODE, std::string()))) { - LogPrintf("The claim trie database contains deprecated data and will need to be rebuilt"); + LogPrintf("The claim trie database contains deprecated data and will need to be rebuilt\n"); return false; } return validateTrieConsistency(tip); diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index bd7867cee..cc31937f9 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -188,12 +188,14 @@ bool CDBWrapper::Sync() { bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync) { + if (!pdb) + return false; + const bool log_memory = LogAcceptCategory(BCLog::LEVELDB); double mem_before = 0; if (log_memory) { mem_before = DynamicMemoryUsage() / 1024.0 / 1024; } - assert(pdb); leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch); dbwrapper_private::HandleError(status); if (log_memory) { diff --git a/src/nameclaim.cpp b/src/nameclaim.cpp index 5bb818669..5decd4f75 100644 --- a/src/nameclaim.cpp +++ b/src/nameclaim.cpp @@ -1,9 +1,6 @@ -#include #include "nameclaim.h" #include "hash.h" #include "util.h" -#include "claimtrie.h" - std::vector uint32_t_to_vch(uint32_t n) { @@ -21,7 +18,7 @@ uint32_t vch_to_uint32_t(std::vector& vchN) uint32_t n; static const size_t uint32Size = sizeof(uint32_t); if (vchN.size() != uint32Size) { - LogPrintf("%s() : a vector with size other than 4 has been given", __func__); + LogPrintf("%s() : a vector with size other than 4 has been given\n", __func__); return 0; } n = vchN[0] << 24 | vchN[1] << 16 | vchN[2] << 8 | vchN[3]; @@ -203,7 +200,7 @@ CAmount CalcMinClaimTrieFee(const CTransaction& tx, const CAmount &minFeePerName } CAmount min_fee = 0; - BOOST_FOREACH(const CTxOut& txout, tx.vout) + for (const CTxOut& txout: tx.vout) { int op; std::vector > vvchParams; diff --git a/src/validation.cpp b/src/validation.cpp index 5dd587054..fcf5d2cec 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2532,7 +2532,8 @@ void static UpdateTip(const CBlockIndex* pindexNew, const CChainParams& chainPar } std::string warningMessages; - if (!::ChainstateActive().IsInitialBlockDownload()) + auto isInitialBlockDownload = ::ChainstateActive().IsInitialBlockDownload(); + if (!isInitialBlockDownload) { int nUpgraded = 0; const CBlockIndex* pindex = pindexNew; @@ -2561,8 +2562,7 @@ void static UpdateTip(const CBlockIndex* pindexNew, const CChainParams& chainPar } static int64_t lastBlockPrintTime = 0; auto currentTime = GetAdjustedTime(); - auto oldBlock = pindexNew->nTime + MAX_FUTURE_BLOCK_TIME < currentTime; - if (!warningMessages.empty() || !oldBlock || lastBlockPrintTime < currentTime - 15 || LogAcceptCategory(BCLog::CLAIMS)) { + if (!warningMessages.empty() || !isInitialBlockDownload || lastBlockPrintTime < currentTime - 15 || LogAcceptCategory(BCLog::CLAIMS)) { lastBlockPrintTime = currentTime; LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g txb=%lu tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)%s", __func__, pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, pindexNew->nVersion, @@ -2570,12 +2570,11 @@ void static UpdateTip(const CBlockIndex* pindexNew, const CChainParams& chainPar (unsigned long) pindexNew->nChainTx, FormatISO8601DateTime(pindexNew->GetBlockTime()), GuessVerificationProgress(chainParams.TxData(), pindexNew), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1U << 20U)), pcoinsTip->GetCacheSize(), - oldBlock ? " (synchronizing)" : ""); + isInitialBlockDownload ? " IBD" : ""); if (!warningMessages.empty()) LogPrintf(" warning='%s'", warningMessages); /* Continued */ LogPrintf("\n"); } - } /** Disconnect m_chain's tip.