validation: add CChainState.m_from_snapshot_blockhash
This parameter is unused, but in future commits will allow ChainstateManager to differentiate between chainstates created from a UTXO snapshot from those that weren't.
This commit is contained in:
1 parent
d2d0a04a66
commit
8e2ecfe249
2 files changed
+16
-3
No files matched your search
+7
-1
@@ -1244,7 +1244,9 @@ void CoinsViews::InitCache()
|
|||||||
|
|
||||||
// NOTE: for now m_blockman is set to a global, but this will be changed
|
// NOTE: for now m_blockman is set to a global, but this will be changed
|
||||||
// in a future commit.
|
// in a future commit.
|
||||||
CChainState::CChainState() : m_blockman(g_blockman) {}
|
CChainState::CChainState(uint256 from_snapshot_blockhash)
|
||||||
|
: m_blockman(g_blockman),
|
||||||
|
m_from_snapshot_blockhash(from_snapshot_blockhash) {}
|
||||||
|
|
||||||
|
|
||||||
void CChainState::InitCoinsDB(
|
void CChainState::InitCoinsDB(
|
||||||
@@ -1253,6 +1255,10 @@ void CChainState::InitCoinsDB(
|
|||||||
bool should_wipe,
|
bool should_wipe,
|
||||||
std::string leveldb_name)
|
std::string leveldb_name)
|
||||||
{
|
{
|
||||||
|
if (!m_from_snapshot_blockhash.IsNull()) {
|
||||||
|
leveldb_name += "_" + m_from_snapshot_blockhash.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
m_coins_views = MakeUnique<CoinsViews>(
|
m_coins_views = MakeUnique<CoinsViews>(
|
||||||
leveldb_name, cache_size_bytes, in_memory, should_wipe);
|
leveldb_name, cache_size_bytes, in_memory, should_wipe);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-2
@@ -591,8 +591,8 @@ private:
|
|||||||
std::unique_ptr<CoinsViews> m_coins_views;
|
std::unique_ptr<CoinsViews> m_coins_views;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CChainState(BlockManager& blockman) : m_blockman(blockman) {}
|
explicit CChainState(BlockManager& blockman) : m_blockman(blockman) {}
|
||||||
CChainState();
|
explicit CChainState(uint256 from_snapshot_blockhash = uint256());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the CoinsViews UTXO set database management data structures. The in-memory
|
* Initialize the CoinsViews UTXO set database management data structures. The in-memory
|
||||||
@@ -620,6 +620,13 @@ public:
|
|||||||
//! @see CChain, CBlockIndex.
|
//! @see CChain, CBlockIndex.
|
||||||
CChain m_chain;
|
CChain m_chain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The blockhash which is the base of the snapshot this chainstate was created from.
|
||||||
|
*
|
||||||
|
* IsNull() if this chainstate was not created from a snapshot.
|
||||||
|
*/
|
||||||
|
const uint256 m_from_snapshot_blockhash{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and
|
* The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and
|
||||||
* as good as our current tip or better. Entries may be failed, though, and pruning nodes may be
|
* as good as our current tip or better. Entries may be failed, though, and pruning nodes may be
|
||||||
|
|||||||
Reference in new issue
Block a user