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

Method findAncestorByHash

src/node/interfaces.cpp:521–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);
524 const CChain& active = Assert(m_node.chainman)->ActiveChain();
525 const CBlockIndex* block = m_node.chainman->m_blockman.LookupBlockIndex(block_hash);
526 const CBlockIndex* ancestor = m_node.chainman->m_blockman.LookupBlockIndex(ancestor_hash);
527 if (block && ancestor && block->GetAncestor(ancestor->nHeight) != ancestor) ancestor = nullptr;
528 return FillBlock(ancestor, ancestor_out, lock, active);
529 }
530 bool findCommonAncestor(const uint256& block_hash1, const uint256& block_hash2, const FoundBlock& ancestor_out, const FoundBlock& block1_out, const FoundBlock& block2_out) override
531 {
532 WAIT_LOCK(cs_main, lock);

Callers 2

importprunedfundsFunction · 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