MCPcopy Create free account
hub / github.com/ElementsProject/elements / ProcessBlock

Method ProcessBlock

src/net_processing.cpp:2567–2582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2565}
2566
2567void PeerManagerImpl::ProcessBlock(CNode& node, const std::shared_ptr<const CBlock>& block, bool force_processing)
2568{
2569 bool new_block{false};
2570 m_chainman.ProcessNewBlock(m_chainparams, block, force_processing, &new_block);
2571 if (new_block) {
2572 node.m_last_block_time = GetTime<std::chrono::seconds>();
2573 // In case this block came from a different peer than we requested
2574 // from, we can erase the block request now anyway (as we just stored
2575 // this block to disk).
2576 LOCK(cs_main);
2577 RemoveBlockRequest(block->GetHash(), std::nullopt);
2578 } else {
2579 LOCK(cs_main);
2580 mapBlockSource.erase(block->GetHash());
2581 }
2582}
2583
2584void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv,
2585 const std::chrono::microseconds time_received,

Callers

nothing calls this directly

Calls 3

ProcessNewBlockMethod · 0.80
GetHashMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected