// Calculate map of txids -> positions and check mempool to see what we have (or dont)
// Because well-formed cmpctblock messages will have a (relatively) uniform distribution
@ -103,11 +105,15 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
@@ -103,11 +105,15 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
if(!have_txn[idit->second]){
txn_available[idit->second]=it->GetSharedTx();
have_txn[idit->second]=true;
mempool_count++;
}else{
// 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,
// but eating a round-trip due to FillBlock failure would be annoying
if(txn_available[idit->second]){
txn_available[idit->second].reset();
mempool_count--;
}
}
}
// Though ideally we'd continue scanning for the two-txn-match-shortid case,
@ -117,6 +123,8 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
@@ -117,6 +123,8 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
break;
}
LogPrint("cmpctblock","Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n",cmpctblock.header.GetHash().ToString(),cmpctblock.GetSerializeSize(SER_NETWORK,PROTOCOL_VERSION));