mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
add ChainstateManager.GetSnapshot{BaseHeight,BaseBlock}()
For use in later commits.
This commit is contained in:
@@ -5365,3 +5365,16 @@ bool IsBIP30Unspendable(const CBlockIndex& block_index)
|
|||||||
return (block_index.nHeight==91722 && block_index.GetBlockHash() == uint256S("0x00000000000271a2dc26e7667f8419f2e15416dc6955e5a6c6cdf3f2574dd08e")) ||
|
return (block_index.nHeight==91722 && block_index.GetBlockHash() == uint256S("0x00000000000271a2dc26e7667f8419f2e15416dc6955e5a6c6cdf3f2574dd08e")) ||
|
||||||
(block_index.nHeight==91812 && block_index.GetBlockHash() == uint256S("0x00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f"));
|
(block_index.nHeight==91812 && block_index.GetBlockHash() == uint256S("0x00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CBlockIndex* ChainstateManager::GetSnapshotBaseBlock() const
|
||||||
|
{
|
||||||
|
const auto blockhash_op = this->SnapshotBlockhash();
|
||||||
|
if (!blockhash_op) return nullptr;
|
||||||
|
return Assert(m_blockman.LookupBlockIndex(*blockhash_op));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<int> ChainstateManager::GetSnapshotBaseHeight() const
|
||||||
|
{
|
||||||
|
const CBlockIndex* base = this->GetSnapshotBaseBlock();
|
||||||
|
return base ? std::make_optional(base->nHeight) : std::nullopt;
|
||||||
|
}
|
||||||
|
|||||||
@@ -869,6 +869,13 @@ private:
|
|||||||
/** Most recent headers presync progress update, for rate-limiting. */
|
/** Most recent headers presync progress update, for rate-limiting. */
|
||||||
std::chrono::time_point<std::chrono::steady_clock> m_last_presync_update GUARDED_BY(::cs_main) {};
|
std::chrono::time_point<std::chrono::steady_clock> m_last_presync_update GUARDED_BY(::cs_main) {};
|
||||||
|
|
||||||
|
//! Returns nullptr if no snapshot has been loaded.
|
||||||
|
const CBlockIndex* GetSnapshotBaseBlock() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||||
|
|
||||||
|
//! Return the height of the base block of the snapshot in use, if one exists, else
|
||||||
|
//! nullopt.
|
||||||
|
std::optional<int> GetSnapshotBaseHeight() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Options = kernel::ChainstateManagerOpts;
|
using Options = kernel::ChainstateManagerOpts;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user