Changeset View
Changeset View
Standalone View
Standalone View
src/blockencodings.cpp
Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | for (auto &extra_txn : extra_txns) { | ||||
// Though ideally we'd continue scanning for the two-txn-match-shortid | // Though ideally we'd continue scanning for the two-txn-match-shortid | ||||
// case, the performance win of an early exit here is too good to pass | // case, the performance win of an early exit here is too good to pass | ||||
// up and worth the extra risk. | // up and worth the extra risk. | ||||
if (mempool_count == shorttxids.size()) { | if (mempool_count == shorttxids.size()) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
LogPrint(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for " | LogPrint(BCLog::CMPCTBLOCK, | ||||
"block %s using a cmpctblock of size %lu\n", | "Initialized PartiallyDownloadedBlock for block %s using a " | ||||
"cmpctblock of size %lu\n", | |||||
cmpctblock.header.GetHash().ToString(), | cmpctblock.header.GetHash().ToString(), | ||||
GetSerializeSize(cmpctblock, SER_NETWORK, PROTOCOL_VERSION)); | GetSerializeSize(cmpctblock, SER_NETWORK, PROTOCOL_VERSION)); | ||||
return READ_STATUS_OK; | return READ_STATUS_OK; | ||||
} | } | ||||
bool PartiallyDownloadedBlock::IsTxAvailable(size_t index) const { | bool PartiallyDownloadedBlock::IsTxAvailable(size_t index) const { | ||||
assert(!header.IsNull()); | assert(!header.IsNull()); | ||||
Show All 37 Lines | if (!CheckBlock(*config, block, state)) { | ||||
// and cache that check. | // and cache that check. | ||||
if (state.CorruptionPossible()) { | if (state.CorruptionPossible()) { | ||||
// Possible Short ID collision. | // Possible Short ID collision. | ||||
return READ_STATUS_FAILED; | return READ_STATUS_FAILED; | ||||
} | } | ||||
return READ_STATUS_CHECKBLOCK_FAILED; | return READ_STATUS_CHECKBLOCK_FAILED; | ||||
} | } | ||||
LogPrint(BCLog::CMPCTBLOCK, "Successfully reconstructed block %s with %lu " | LogPrint(BCLog::CMPCTBLOCK, | ||||
"txn prefilled, %lu txn from mempool (incl at " | "Successfully reconstructed block %s with %lu txn prefilled, %lu " | ||||
"least %lu from extra pool) and %lu txn " | "txn from mempool (incl at least %lu from extra pool) and %lu txn " | ||||
"requested\n", | "requested\n", | ||||
hash.ToString(), prefilled_count, mempool_count, extra_count, | hash.ToString(), prefilled_count, mempool_count, extra_count, | ||||
vtx_missing.size()); | 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(BCLog::CMPCTBLOCK, | LogPrint(BCLog::CMPCTBLOCK, | ||||
"Reconstructed block %s required tx %s\n", hash.ToString(), | "Reconstructed block %s required tx %s\n", hash.ToString(), | ||||
tx->GetId().ToString()); | tx->GetId().ToString()); | ||||
} | } | ||||
} | } | ||||
return READ_STATUS_OK; | return READ_STATUS_OK; | ||||
} | } |