diff --git a/ci/dash/lint-tidy.sh b/ci/dash/lint-tidy.sh index 0ed43ce633b4..159591d81ed2 100755 --- a/ci/dash/lint-tidy.sh +++ b/ci/dash/lint-tidy.sh @@ -87,7 +87,7 @@ iwyu_tool.py \ "src/compat" \ "src/dbwrapper.cpp" \ "src/init" \ - "src/kernel/mempool_persist.cpp" \ + "src/kernel" \ "src/node/chainstate.cpp" \ "src/node/minisketchwrapper.cpp" \ "src/policy/feerate.cpp" \ diff --git a/doc/design/assumeutxo.md b/doc/design/assumeutxo.md index 667b3deda0b5..74aff7d392f8 100644 --- a/doc/design/assumeutxo.md +++ b/doc/design/assumeutxo.md @@ -41,7 +41,7 @@ be of use. Chainstate within the system goes through a number of phases when UTXO snapshots are used, as managed by `ChainstateManager`. At various points there can be multiple -`CChainState` objects in existence to facilitate both maintaining the network tip and +`Chainstate` objects in existence to facilitate both maintaining the network tip and performing historical validation of the assumed-valid chain. It is worth noting that though there are multiple separate chainstates, those @@ -53,7 +53,7 @@ data. ### "Normal" operation via initial block download -`ChainstateManager` manages a single CChainState object, for which +`ChainstateManager` manages a single Chainstate object, for which `m_snapshot_blockhash` is null. This chainstate is (maybe obviously) considered active. This is the "traditional" mode of operation for dashd. @@ -76,8 +76,9 @@ original chainstate remains in use as active. Once the snapshot chainstate is loaded and validated, it is promoted to active chainstate and a sync to tip begins. A new chainstate directory is created in the -datadir for the snapshot chainstate called -`chainstate_[SHA256 blockhash of snapshot base block]`. +datadir for the snapshot chainstate called `chainstate_snapshot`. When this directory +is present in the datadir, the snapshot chainstate will be detected and loaded as +active on node startup (via `DetectSnapshotChainstate()`). | | | | ---------- | ----------- | diff --git a/doc/developer-notes.md b/doc/developer-notes.md index c343f3a7e007..61025728bef1 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -1034,7 +1034,7 @@ void CTxMemPool::UpdateTransactionsFromBlock(...) ```C++ // validation.h -class CChainState +class Chainstate { protected: ... @@ -1055,7 +1055,7 @@ public: } // validation.cpp -bool CChainState::PreciousBlock(BlockValidationState& state, CBlockIndex* pindex) +bool Chainstate::PreciousBlock(BlockValidationState& state, CBlockIndex* pindex) { AssertLockNotHeld(m_chainstate_mutex); AssertLockNotHeld(::cs_main); diff --git a/src/Makefile.am b/src/Makefile.am index b517564e1ab5..d0fba95a19b1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -612,6 +612,7 @@ libbitcoin_node_a_SOURCES = \ node/sync_manager.cpp \ node/transaction.cpp \ node/txreconciliation.cpp \ + node/utxo_snapshot.cpp \ noui.cpp \ policy/fees.cpp \ policy/fees_args.cpp \ @@ -1316,6 +1317,7 @@ libdashkernel_la_SOURCES = \ node/chainstate.cpp \ node/interface_ui.cpp \ node/transaction.cpp \ + node/utxo_snapshot.cpp \ policy/feerate.cpp \ policy/fees.cpp \ policy/packages.cpp \ diff --git a/src/bench/load_external.cpp b/src/bench/load_external.cpp index 150654a095ca..ec97be45ff1e 100644 --- a/src/bench/load_external.cpp +++ b/src/bench/load_external.cpp @@ -48,7 +48,7 @@ static void LoadExternalBlockFile(benchmark::Bench& bench) fclose(file); } - CChainState& chainstate{testing_setup->m_node.chainman->ActiveChainstate()}; + Chainstate& chainstate{testing_setup->m_node.chainman->ActiveChainstate()}; std::multimap blocks_with_unknown_parent; FlatFilePos pos; bench.run([&] { diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp index 0c6ddf58d831..07373cc00cbd 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include