File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -1244,7 +1244,9 @@ void CoinsViews::InitCache()
1244
1244
1245
1245
// NOTE: for now m_blockman is set to a global, but this will be changed
1246
1246
// in a future commit.
1247
- CChainState::CChainState () : m_blockman(g_blockman) {}
1247
+ CChainState::CChainState (uint256 from_snapshot_blockhash)
1248
+ : m_blockman(g_blockman),
1249
+ m_from_snapshot_blockhash(from_snapshot_blockhash) {}
1248
1250
1249
1251
1250
1252
void CChainState::InitCoinsDB (
@@ -1253,6 +1255,10 @@ void CChainState::InitCoinsDB(
1253
1255
bool should_wipe,
1254
1256
std::string leveldb_name)
1255
1257
{
1258
+ if (!m_from_snapshot_blockhash.IsNull ()) {
1259
+ leveldb_name += " _" + m_from_snapshot_blockhash.ToString ();
1260
+ }
1261
+
1256
1262
m_coins_views = MakeUnique<CoinsViews>(
1257
1263
leveldb_name, cache_size_bytes, in_memory, should_wipe);
1258
1264
}
Original file line number Diff line number Diff line change @@ -591,8 +591,8 @@ class CChainState {
591
591
std::unique_ptr<CoinsViews> m_coins_views;
592
592
593
593
public:
594
- CChainState (BlockManager& blockman) : m_blockman(blockman) {}
595
- CChainState ();
594
+ explicit CChainState (BlockManager& blockman) : m_blockman(blockman) {}
595
+ explicit CChainState (uint256 from_snapshot_blockhash = uint256() );
596
596
597
597
/* *
598
598
* Initialize the CoinsViews UTXO set database management data structures. The in-memory
@@ -620,6 +620,13 @@ class CChainState {
620
620
// ! @see CChain, CBlockIndex.
621
621
CChain m_chain;
622
622
623
+ /* *
624
+ * The blockhash which is the base of the snapshot this chainstate was created from.
625
+ *
626
+ * IsNull() if this chainstate was not created from a snapshot.
627
+ */
628
+ const uint256 m_from_snapshot_blockhash{};
629
+
623
630
/* *
624
631
* The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and
625
632
* as good as our current tip or better. Entries may be failed, though, and pruning nodes may be
You can’t perform that action at this time.
0 commit comments