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

Method findAncestorByHeight

src/node/interfaces.cpp:611–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609 return FillBlock(active.FindEarliestAtLeast(min_time, min_height), block, lock, active, chainman().m_blockman);
610 }
611 bool findAncestorByHeight(const uint256& block_hash, int ancestor_height, const FoundBlock& ancestor_out) override
612 {
613 WAIT_LOCK(cs_main, lock);
614 const CChain& active = chainman().ActiveChain();
615 if (const CBlockIndex* block = chainman().m_blockman.LookupBlockIndex(block_hash)) {
616 if (const CBlockIndex* ancestor = block->GetAncestor(ancestor_height)) {
617 return FillBlock(ancestor, ancestor_out, lock, active, chainman().m_blockman);
618 }
619 }
620 return FillBlock(nullptr, ancestor_out, lock, active, chainman().m_blockman);
621 }
622 bool findAncestorByHash(const uint256& block_hash, const uint256& ancestor_hash, const FoundBlock& ancestor_out) override
623 {
624 WAIT_LOCK(cs_main, lock);

Callers 4

listsinceblockFunction · 0.80
rescanblockchainFunction · 0.80
BOOST_FIXTURE_TEST_CASEFunction · 0.80

Calls 2

LookupBlockIndexMethod · 0.80
GetAncestorMethod · 0.45

Tested by 1

BOOST_FIXTURE_TEST_CASEFunction · 0.64