-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: move evodb out from chainstate #7603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
e4c3462
5850a57
23f695f
050bdb9
79b9df4
701dc48
f03d485
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -429,13 +429,12 @@ void PrepareShutdown(NodeContext& node) | |
| chainstate->ResetCoinsViews(); | ||
| } | ||
| } | ||
| // The mempool holds raw pointers to dmnman and llmq_ctx->isman, so it has to | ||
| // let go of them before either manager is destroyed. | ||
| if (node.mempool) { | ||
| node.mempool->DisconnectManagers(); | ||
| } | ||
| // The mempool holds raw pointers to dmnman and isman, so it must be | ||
| // destroyed before either manager. | ||
| node.mempool.reset(); | ||
| node.chain_helper.reset(); | ||
| node.llmq_ctx.reset(); | ||
| node.isman.reset(); | ||
| node.dmnman.reset(); | ||
| node.evodb.reset(); | ||
| } | ||
|
|
@@ -900,7 +899,7 @@ static void PeriodicStats(NodeContext& node) | |
| assert(::g_stats_client->active()); | ||
| ChainstateManager& chainman = *Assert(node.chainman); | ||
| const CTxMemPool& mempool = *Assert(node.mempool); | ||
| const llmq::CInstantSendManager& isman = *Assert(node.llmq_ctx->isman); | ||
| const llmq::CInstantSendManager& isman = *Assert(node.isman); | ||
| chainman.ActiveChainstate().ForceFlushStateToDisk(); | ||
| const auto maybe_stats = WITH_LOCK(::cs_main, return GetUTXOStats(&chainman.ActiveChainstate().CoinsDB(), chainman.m_blockman, /*hash_type=*/CoinStatsHashType::NONE, node.rpc_interruption_point, chainman.ActiveChain().Tip(), /*index_requested=*/true)); | ||
| if (maybe_stats.has_value()) { | ||
|
|
@@ -1949,6 +1948,18 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
| LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)\n", cache_sizes.coins * (1.0 / 1024 / 1024), mempool_opts.max_size_bytes * (1.0 / 1024 / 1024)); | ||
|
|
||
| for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) { | ||
| // On a retry iteration the previous instances still hold the on-disk | ||
| // database locks, so release them before opening the databases again. | ||
| node.mempool.reset(); | ||
| node.isman.reset(); | ||
| node.dmnman.reset(); | ||
| node.evodb.reset(); | ||
| node.evodb = std::make_unique<CEvoDB>(util::DbWrapperParams{.path = args.GetDataDirNet(), .memory = false, .wipe = node::fReindex || fReindexChainState}); | ||
| node.dmnman = std::make_unique<CDeterministicMNManager>(*node.evodb, *node.mn_metaman); | ||
| node.isman = std::make_unique<llmq::CInstantSendManager>(*node.sporkman, util::DbWrapperParams{.path = args.GetDataDirNet(), .memory = false, .wipe = node::fReindex || fReindexChainState}); | ||
|
Comment on lines
+1957
to
+1959
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When AGENTS.md reference: AGENTS.md:L170-L172 Useful? React with 👍 / 👎.
Comment on lines
+1957
to
+1959
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Keep Dash database opens inside the recoverable startup path The source: ['codex'] |
||
|
|
||
| mempool_opts.dmnman = node.dmnman.get(); | ||
| mempool_opts.isman = node.isman.get(); | ||
| node.mempool = std::make_unique<CTxMemPool>(mempool_opts); | ||
|
|
||
| const ChainstateManager::Options chainman_opts{ | ||
|
|
@@ -1969,8 +1980,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
|
|
||
| node::ChainstateLoadOptions options; | ||
| options.mempool = Assert(node.mempool.get()); | ||
| options.mn_metaman = Assert(node.mn_metaman.get()); | ||
| options.sporkman = Assert(node.sporkman.get()); | ||
| options.isman = Assert(node.isman.get()); | ||
| options.chainlocks = Assert(node.chainlocks.get()); | ||
| options.mn_sync = Assert(node.mn_sync.get()); | ||
| options.data_dir = args.GetDataDirNet(); | ||
|
|
@@ -2008,7 +2018,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
| return std::make_tuple(node::ChainstateLoadStatus::FAILURE, _("Error opening block database")); | ||
| } | ||
| }; | ||
| auto [status, error] = catch_exceptions([&]{ return LoadChainstate(chainman, cache_sizes, options, node.evodb, node.dmnman, node.llmq_ctx, node.chain_helper); }); | ||
| auto [status, error] = catch_exceptions([&]{ return LoadChainstate(chainman, cache_sizes, options, *node.evodb, *node.dmnman, node.llmq_ctx, node.chain_helper); }); | ||
| if (status == node::ChainstateLoadStatus::SUCCESS) { | ||
| uiInterface.InitMessage(_("Verifying blocks…").translated); | ||
| if (chainman.m_blockman.m_have_pruned && options.check_blocks > MIN_BLOCKS_TO_KEEP) { | ||
|
|
@@ -2083,7 +2093,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
| // Will init later in ThreadImport | ||
| node.active_ctx = std::make_unique<ActiveContext>(*node.llmq_ctx->bls_worker, chainman, *node.connman, *node.dmnman, | ||
| *node.govman, *node.chain_helper->superblocks, | ||
| *node.sporkman, *node.chainlocks, *node.mempool, *node.clhandler, *node.llmq_ctx->isman, | ||
| *node.sporkman, *node.chainlocks, *node.mempool, *node.clhandler, *node.isman, | ||
| *node.llmq_ctx->qman, *node.llmq_ctx->qsnapman, *node.llmq_ctx->sigman, | ||
| *node.mn_sync, operator_sk, dash_db_params, quorums_watch); | ||
| RegisterValidationInterface(node.active_ctx.get()); | ||
|
|
@@ -2098,7 +2108,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
| chainman, *node.mempool, *node.mn_metaman, *node.mn_sync, | ||
| *node.sporkman, *node.chainlocks, *node.clhandler, | ||
| node.active_ctx ? node.active_ctx->nodeman.get() : nullptr, | ||
| node.dmnman, node.cj_walletman, node.llmq_ctx, ignores_incoming_txs); | ||
| node.dmnman, node.cj_walletman, *node.isman, node.llmq_ctx, ignores_incoming_txs); | ||
| RegisterValidationInterface(node.peerman.get()); | ||
|
|
||
| node.ds_notification_interface = std::make_unique<CDSNotificationInterface>( | ||
|
|
@@ -2108,7 +2118,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
|
|
||
| // ********************************************************* Step 7d: Setup other Dash services | ||
|
|
||
| node.peerman->AddExtraHandler(std::make_unique<NetInstantSend>(node.peerman.get(), *node.llmq_ctx->isman, node.active_ctx ? node.active_ctx->is_signer.get() : nullptr, *node.llmq_ctx->sigman, *node.llmq_ctx->qman, *node.chainlocks, chainman, *node.mempool, *node.mn_sync)); | ||
| node.peerman->AddExtraHandler(std::make_unique<NetInstantSend>(node.peerman.get(), *node.isman, node.active_ctx ? node.active_ctx->is_signer.get() : nullptr, *node.llmq_ctx->sigman, *node.llmq_ctx->qman, *node.chainlocks, chainman, *node.mempool, *node.mn_sync)); | ||
| node.peerman->AddExtraHandler(std::make_unique<llmq::NetSigning>(node.peerman.get(), *node.llmq_ctx->sigman, node.active_ctx ? node.active_ctx->shareman.get() : nullptr, *node.sporkman)); | ||
|
|
||
| { | ||
|
|
@@ -2140,15 +2150,15 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
|
|
||
| if (node.active_ctx) { | ||
| auto cj_server = std::make_unique<CCoinJoinServer>(node.peerman.get(), chainman, *node.connman, *node.dmnman, *node.dstxman, *node.mn_metaman, | ||
| *node.mempool, *node.active_ctx->nodeman, *node.mn_sync, *node.llmq_ctx->isman); | ||
| *node.mempool, *node.active_ctx->nodeman, *node.mn_sync, *node.isman); | ||
| node.active_ctx->SetCJServer(cj_server.get()); | ||
| node.peerman->AddExtraHandler(std::move(cj_server)); | ||
| } else { | ||
| assert(!node.cj_walletman); | ||
| // Only constructed in wallet-enabled builds; stays null otherwise, must check before use | ||
| #ifdef ENABLE_WALLET | ||
| node.cj_walletman = CJWalletManager::make(chainman, *node.dmnman, *node.mn_metaman, *node.mempool, *node.mn_sync, | ||
| *node.llmq_ctx->isman, !ignores_incoming_txs); | ||
| *node.isman, !ignores_incoming_txs); | ||
| #endif | ||
| } | ||
|
|
||
|
|
@@ -2386,7 +2396,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
| // Seed InstantSend tip-height cache; NetInstantSend receives future | ||
| // updates via CValidationInterface but misses InitializeCurrentBlockTip. | ||
| // TODO: move cache updates from NetInstantSend to g_ds_notification due to specific of Tip's processing | ||
| node.llmq_ctx->isman->CacheTipHeight(WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip())); | ||
| node.isman->CacheTipHeight(WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip())); | ||
|
|
||
| { | ||
| // Get all UTXOs for each MN collateral in one go so that we can fill coin cache early | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.