mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
add Chainstate::HasCoinsViews()
Used in subsequent commits. Also cleans up asserts in coins_views-related convenience methods to be more exact.
This commit is contained in:
@@ -553,15 +553,15 @@ public:
|
|||||||
CCoinsViewCache& CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
CCoinsViewCache& CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
||||||
{
|
{
|
||||||
AssertLockHeld(::cs_main);
|
AssertLockHeld(::cs_main);
|
||||||
assert(m_coins_views->m_cacheview);
|
Assert(m_coins_views);
|
||||||
return *m_coins_views->m_cacheview.get();
|
return *Assert(m_coins_views->m_cacheview);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @returns A reference to the on-disk UTXO set database.
|
//! @returns A reference to the on-disk UTXO set database.
|
||||||
CCoinsViewDB& CoinsDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
CCoinsViewDB& CoinsDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
||||||
{
|
{
|
||||||
AssertLockHeld(::cs_main);
|
AssertLockHeld(::cs_main);
|
||||||
return m_coins_views->m_dbview;
|
return Assert(m_coins_views)->m_dbview;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @returns A pointer to the mempool.
|
//! @returns A pointer to the mempool.
|
||||||
@@ -575,12 +575,15 @@ public:
|
|||||||
CCoinsViewErrorCatcher& CoinsErrorCatcher() EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
CCoinsViewErrorCatcher& CoinsErrorCatcher() EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
||||||
{
|
{
|
||||||
AssertLockHeld(::cs_main);
|
AssertLockHeld(::cs_main);
|
||||||
return m_coins_views->m_catcherview;
|
return Assert(m_coins_views)->m_catcherview;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Destructs all objects related to accessing the UTXO set.
|
//! Destructs all objects related to accessing the UTXO set.
|
||||||
void ResetCoinsViews() { m_coins_views.reset(); }
|
void ResetCoinsViews() { m_coins_views.reset(); }
|
||||||
|
|
||||||
|
//! Does this chainstate have a UTXO set attached?
|
||||||
|
bool HasCoinsViews() const { return (bool)m_coins_views; }
|
||||||
|
|
||||||
//! The cache size of the on-disk coins view.
|
//! The cache size of the on-disk coins view.
|
||||||
size_t m_coinsdb_cache_size_bytes{0};
|
size_t m_coinsdb_cache_size_bytes{0};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user