Add extra_count lower bound to compact reconstruction debug print

This commit is contained in:
Matt Corallo 2017-01-12 12:19:14 -08:00
parent 863edb45b9
commit b55b416346
2 changed files with 4 additions and 2 deletions

View file

@ -141,6 +141,7 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
txn_available[idit->second] = extra_txn[i].second; txn_available[idit->second] = extra_txn[i].second;
have_txn[idit->second] = true; have_txn[idit->second] = true;
mempool_count++; mempool_count++;
extra_count++;
} else { } else {
// If we find two mempool txn that match the short id, just request it. // If we find two mempool txn that match the short id, just request it.
// This should be rare enough that the extra bandwidth doesn't matter, // This should be rare enough that the extra bandwidth doesn't matter,
@ -151,6 +152,7 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
txn_available[idit->second]->GetWitnessHash() != extra_txn[i].second->GetWitnessHash()) { txn_available[idit->second]->GetWitnessHash() != extra_txn[i].second->GetWitnessHash()) {
txn_available[idit->second].reset(); txn_available[idit->second].reset();
mempool_count--; mempool_count--;
extra_count--;
} }
} }
} }
@ -206,7 +208,7 @@ ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<
return READ_STATUS_CHECKBLOCK_FAILED; return READ_STATUS_CHECKBLOCK_FAILED;
} }
LogPrint("cmpctblock", "Successfully reconstructed block %s with %lu txn prefilled, %lu txn from mempool and %lu txn requested\n", hash.ToString(), prefilled_count, mempool_count, vtx_missing.size()); LogPrint("cmpctblock", "Successfully reconstructed block %s with %lu txn prefilled, %lu txn from mempool (incl at least %lu from extra pool) and %lu txn requested\n", hash.ToString(), prefilled_count, mempool_count, extra_count, vtx_missing.size());
if (vtx_missing.size() < 5) { if (vtx_missing.size() < 5) {
for (const auto& tx : vtx_missing) for (const auto& tx : vtx_missing)
LogPrint("cmpctblock", "Reconstructed block %s required tx %s\n", hash.ToString(), tx->GetHash().ToString()); LogPrint("cmpctblock", "Reconstructed block %s required tx %s\n", hash.ToString(), tx->GetHash().ToString());

View file

@ -194,7 +194,7 @@ public:
class PartiallyDownloadedBlock { class PartiallyDownloadedBlock {
protected: protected:
std::vector<CTransactionRef> txn_available; std::vector<CTransactionRef> txn_available;
size_t prefilled_count = 0, mempool_count = 0; size_t prefilled_count = 0, mempool_count = 0, extra_count = 0;
CTxMemPool* pool; CTxMemPool* pool;
public: public:
CBlockHeader header; CBlockHeader header;