mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Add functions to construct locators without CChain
This introduces an insignificant performance penalty, as it means locator construction needs to use the skiplist-based CBlockIndex::GetAncestor() function instead of the lookup-based CChain, but avoids the need for callers to have access to a relevant CChain object.
This commit is contained in:
committed by
Suhas Daftuar
parent
84852bb6bb
commit
ed470940cd
@@ -400,7 +400,7 @@ bool FillBlock(const CBlockIndex* index, const FoundBlock& block, UniqueLock<Rec
|
||||
if (block.m_max_time) *block.m_max_time = index->GetBlockTimeMax();
|
||||
if (block.m_mtp_time) *block.m_mtp_time = index->GetMedianTimePast();
|
||||
if (block.m_in_active_chain) *block.m_in_active_chain = active[index->nHeight] == index;
|
||||
if (block.m_locator) { *block.m_locator = active.GetLocator(index); }
|
||||
if (block.m_locator) { *block.m_locator = GetLocator(index); }
|
||||
if (block.m_next_block) FillBlock(active[index->nHeight] == index ? active[index->nHeight + 1] : nullptr, *block.m_next_block, lock, active);
|
||||
if (block.m_data) {
|
||||
REVERSE_LOCK(lock);
|
||||
@@ -527,8 +527,7 @@ public:
|
||||
{
|
||||
LOCK(::cs_main);
|
||||
const CBlockIndex* index = chainman().m_blockman.LookupBlockIndex(block_hash);
|
||||
if (!index) return {};
|
||||
return chainman().ActiveChain().GetLocator(index);
|
||||
return GetLocator(index);
|
||||
}
|
||||
std::optional<int> findLocatorFork(const CBlockLocator& locator) override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user