MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ProcessBlock

Method ProcessBlock

src/net_processing.cpp:3455–3470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3453}
3454
3455void PeerManagerImpl::ProcessBlock(CNode& node, const std::shared_ptr<const CBlock>& block, bool force_processing, bool min_pow_checked)
3456{
3457 bool new_block{false};
3458 m_chainman.ProcessNewBlock(block, force_processing, min_pow_checked, &new_block);
3459 if (new_block) {
3460 node.m_last_block_time = GetTime<std::chrono::seconds>();
3461 // In case this block came from a different peer than we requested
3462 // from, we can erase the block request now anyway (as we just stored
3463 // this block to disk).
3464 LOCK(cs_main);
3465 RemoveBlockRequest(block->GetHash(), std::nullopt);
3466 } else {
3467 LOCK(cs_main);
3468 mapBlockSource.erase(block->GetHash());
3469 }
3470}
3471
3472void PeerManagerImpl::ProcessCompactBlockTxns(CNode& pfrom, Peer& peer, const BlockTransactions& block_transactions)
3473{

Callers

nothing calls this directly

Calls 3

ProcessNewBlockMethod · 0.80
GetHashMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected