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

Method findAncestorByHeight

src/node/interfaces.cpp:510–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508 return FillBlock(active.FindEarliestAtLeast(min_time, min_height), block, lock, active);
509 }
510 bool findAncestorByHeight(const uint256& block_hash, int ancestor_height, const FoundBlock& ancestor_out) override
511 {
512 WAIT_LOCK(cs_main, lock);
513 const CChain& active = Assert(m_node.chainman)->ActiveChain();
514 if (const CBlockIndex* block = m_node.chainman->m_blockman.LookupBlockIndex(block_hash)) {
515 if (const CBlockIndex* ancestor = block->GetAncestor(ancestor_height)) {
516 return FillBlock(ancestor, ancestor_out, lock, active);
517 }
518 }
519 return FillBlock(nullptr, ancestor_out, lock, active);
520 }
521 bool findAncestorByHash(const uint256& block_hash, const uint256& ancestor_hash, const FoundBlock& ancestor_out) override
522 {
523 WAIT_LOCK(cs_main, lock);

Callers 5

GetKeyBirthTimesMethod · 0.80
listsinceblockFunction · 0.80
transactions.cppFile · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 3

FillBlockFunction · 0.85
LookupBlockIndexMethod · 0.80
GetAncestorMethod · 0.80

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64