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

Method BlockRequestAllowed

src/net_processing.cpp:1976–1983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1974}
1975
1976bool PeerManagerImpl::BlockRequestAllowed(const CBlockIndex& block_index)
1977{
1978 AssertLockHeld(cs_main);
1979 if (m_chainman.ActiveChain().Contains(block_index)) return true;
1980 return block_index.IsValid(BLOCK_VALID_SCRIPTS) && (m_chainman.m_best_header != nullptr) &&
1981 (m_chainman.m_best_header->GetBlockTime() - block_index.GetBlockTime() < STALE_RELAY_AGE_LIMIT) &&
1982 (GetBlockProofEquivalentTime(*m_chainman.m_best_header, block_index, *m_chainman.m_best_header, m_chainparams.GetConsensus()) < STALE_RELAY_AGE_LIMIT);
1983}
1984
1985util::Expected<void, std::string> PeerManagerImpl::FetchBlock(NodeId peer_id, const CBlockIndex& block_index)
1986{

Callers

nothing calls this directly

Calls 4

ContainsMethod · 0.45
IsValidMethod · 0.45
GetBlockTimeMethod · 0.45

Tested by

no test coverage detected