MCPcopy Create free account
hub / github.com/LUX-Core/lux / DEV_GUARDED

Function DEV_GUARDED

src/cpp-ethereum/libethereum/BlockQueue.cpp:270–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268{
269 DEV_INVARIANT_CHECK;
270 DEV_GUARDED(m_verification)
271 {
272 collectUnknownBad_WITH_BOTH_LOCKS(_bad);
273 bool moreBad = true;
274 while (moreBad)
275 {
276 moreBad = false;
277 std::vector<VerifiedBlock> badVerified = m_verified.removeIf([this](VerifiedBlock const& _b)
278 {
279 return m_knownBad.count(_b.verified.info.parentHash()) || m_knownBad.count(_b.verified.info.hash());
280 });
281 for (auto& b: badVerified)
282 {
283 m_knownBad.insert(b.verified.info.hash());
284 m_readySet.erase(b.verified.info.hash());
285 collectUnknownBad_WITH_BOTH_LOCKS(b.verified.info.hash());
286 moreBad = true;
287 }
288
289 std::vector<UnverifiedBlock> badUnverified = m_unverified.removeIf([this](UnverifiedBlock const& _b)
290 {
291 return m_knownBad.count(_b.parentHash) || m_knownBad.count(_b.hash);
292 });
293 for (auto& b: badUnverified)
294 {
295 m_knownBad.insert(b.hash);
296 m_readySet.erase(b.hash);
297 collectUnknownBad_WITH_BOTH_LOCKS(b.hash);
298 moreBad = true;
299 }
300
301 std::vector<VerifiedBlock> badVerifying = m_verifying.removeIf([this](VerifiedBlock const& _b)
302 {
303 return m_knownBad.count(_b.verified.info.parentHash()) || m_knownBad.count(_b.verified.info.sha3Uncles());
304 });
305 for (auto& b: badVerifying)
306 {
307 h256 const& h = b.blockData.size() != 0 ? b.verified.info.hash() : b.verified.info.sha3Uncles();
308 m_knownBad.insert(h);
309 m_readySet.erase(h);
310 collectUnknownBad_WITH_BOTH_LOCKS(h);
311 moreBad = true;
312 }
313 }
314 }
315}
316
317void BlockQueue::collectUnknownBad_WITH_BOTH_LOCKS(h256 const& _bad)

Callers 14

maintainBlocksMethod · 0.70
onTransactionImportedMethod · 0.70
stopMethod · 0.70
importMethod · 0.70
DEV_WRITE_GUARDEDFunction · 0.70
noteReady_WITH_LOCKMethod · 0.70
retryAllUnknownMethod · 0.70
isActiveMethod · 0.70
onPeerNewBlockMethod · 0.70
onPeerNewHashesMethod · 0.70
checkWatchGarbageMethod · 0.70
~TransactionQueueMethod · 0.70

Calls 6

removeIfMethod · 0.80
countMethod · 0.45
hashMethod · 0.45
insertMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected