Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/chain.cpp
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | public: | ||||
std::unique_ptr<Chain::Lock> result = std::move(lock); | std::unique_ptr<Chain::Lock> result = std::move(lock); | ||||
return result; | return result; | ||||
} | } | ||||
bool findBlock(const BlockHash &hash, | bool findBlock(const BlockHash &hash, | ||||
const FoundBlock &block) override { | const FoundBlock &block) override { | ||||
WAIT_LOCK(cs_main, lock); | WAIT_LOCK(cs_main, lock); | ||||
return FillBlock(LookupBlockIndex(hash), block, lock); | return FillBlock(LookupBlockIndex(hash), block, lock); | ||||
} | } | ||||
bool findFirstBlockWithTimeAndHeight(int64_t min_time, int min_height, | |||||
const FoundBlock &block) override { | |||||
WAIT_LOCK(cs_main, lock); | |||||
return FillBlock( | |||||
ChainActive().FindEarliestAtLeast(min_time, min_height), block, | |||||
lock); | |||||
} | |||||
bool findAncestorByHeight(const BlockHash &block_hash, | bool findAncestorByHeight(const BlockHash &block_hash, | ||||
int ancestor_height, | int ancestor_height, | ||||
const FoundBlock &ancestor_out) override { | const FoundBlock &ancestor_out) override { | ||||
WAIT_LOCK(cs_main, lock); | WAIT_LOCK(cs_main, lock); | ||||
if (const CBlockIndex *block = LookupBlockIndex(block_hash)) { | if (const CBlockIndex *block = LookupBlockIndex(block_hash)) { | ||||
if (const CBlockIndex *ancestor = | if (const CBlockIndex *ancestor = | ||||
block->GetAncestor(ancestor_height)) { | block->GetAncestor(ancestor_height)) { | ||||
return FillBlock(ancestor, ancestor_out, lock); | return FillBlock(ancestor, ancestor_out, lock); | ||||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |