Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 975 Lines • ▼ Show 20 Lines | switch (inv.type) { | ||||
// If the chain tip has changed previously rejected transactions | // If the chain tip has changed previously rejected transactions | ||||
// might be now valid, e.g. due to a nLockTime'd tx becoming | // might be now valid, e.g. due to a nLockTime'd tx becoming | ||||
// valid, or a double-spend. Reset the rejects filter and give | // valid, or a double-spend. Reset the rejects filter and give | ||||
// those txs a second chance. | // those txs a second chance. | ||||
hashRecentRejectsChainTip = chainActive.Tip()->GetBlockHash(); | hashRecentRejectsChainTip = chainActive.Tip()->GetBlockHash(); | ||||
recentRejects->reset(); | recentRejects->reset(); | ||||
} | } | ||||
// Use pcoinsTip->HaveCoinsInCache as a quick approximation to | // Use pcoinsTip->HaveCoinInCache as a quick approximation to | ||||
// exclude requesting or processing some txs which have already been | // exclude requesting or processing some txs which have already been | ||||
// included in a block. | // included in a block. As this is best effort, we only check for | ||||
// output 0 and 1. This works well enough in practice and we get | |||||
// diminishing returns with 2 onward. | |||||
return recentRejects->contains(inv.hash) || | return recentRejects->contains(inv.hash) || | ||||
mempool.exists(inv.hash) || | mempool.exists(inv.hash) || | ||||
mapOrphanTransactions.count(inv.hash) || | mapOrphanTransactions.count(inv.hash) || | ||||
pcoinsTip->HaveCoinsInCache(inv.hash); | pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 0)) || | ||||
pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 1)); | |||||
} | } | ||||
case MSG_BLOCK: | case MSG_BLOCK: | ||||
return mapBlockIndex.count(inv.hash); | return mapBlockIndex.count(inv.hash); | ||||
} | } | ||||
// Don't know what it is, just say we already got one | // Don't know what it is, just say we already got one | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,662 Lines • Show Last 20 Lines |