mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-07 13:18:43 +02: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
@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(getlocator_test)
|
||||
for (int n=0; n<100; n++) {
|
||||
int r = InsecureRandRange(150000);
|
||||
CBlockIndex* tip = (r < 100000) ? &vBlocksMain[r] : &vBlocksSide[r - 100000];
|
||||
CBlockLocator locator = chain.GetLocator(tip);
|
||||
CBlockLocator locator = GetLocator(tip);
|
||||
|
||||
// The first result must be the block itself, the last one must be genesis.
|
||||
BOOST_CHECK(locator.vHave.front() == tip->GetBlockHash());
|
||||
|
||||
Reference in New Issue
Block a user