Skip to content

fix: follow-up changes for #7451 [bitcoin#25308 and related changes]#7471

Open
knst wants to merge 4 commits into
dashpay:developfrom
knst:fix-bp-25308
Open

fix: follow-up changes for #7451 [bitcoin#25308 and related changes]#7471
knst wants to merge 4 commits into
dashpay:developfrom
knst:fix-bp-25308

Conversation

@knst

@knst knst commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Follow-up changes for #7451

What was done?

How Has This Been Tested?

Run unit & functional tests

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

knst added 3 commits July 17, 2026 14:32
…etup

They are pretty trivial and simple but they are obstacle to implement bitcoin#25308
due to un-needed complexity
Revert changes that introduced by non-backported yet bitcoin#31061
Set default value for worker_count
Move chainhelper, evodb, dmnman, llmq_ctx, data_dir, mn_metaman, sporkman, chainlocks, mn_sync to node::ChainstateLoadOptions same as mempool is done
Pass notify_bls_state to VerifyLoadedChainstate only
Added missing changes for strLoadError from bitcoin#25308
Added missing changes for node::fPruneMode node::fReindex from bitcoin#25308
Fixed duplicated entities in src/test/util/setup_common.cpp as follow-up for bitcoin#25290
@knst knst added this to the 24 milestone Jul 17, 2026
@github-actions

Copy link
Copy Markdown

Potential PR merge conflicts

This is advisory only. It does not block CI, but it marks PRs that will likely need a rebase depending on merge order.

If this PR merges first

These open PRs will likely need a rebase:

@thepastaclaw

thepastaclaw commented Jul 17, 2026

Copy link
Copy Markdown

⛔ Blockers found — Sonnet deferred (commit 4bde03a)
Canonical validated blockers: 1

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/init.cpp (1)

2095-2104: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Tear down the previous chainstate resource graph before a load retry.

A failed load can leave Dash resources bound to the current chain manager, but the reindex retry replaces that manager and LoadChainstate subsequently destroys dependencies before dependents.

  • src/init.cpp#L2095-L2104: release the existing graph before allowing the loop to recreate node.mempool and node.chainman.
  • src/node/chainstate.cpp#L47-L82: perform replacement in reverse dependency order: chain_helper, mempool connection, llmq_ctx, dmnman, then evodb.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/init.cpp` around lines 2095 - 2104, Before setting fReindex in the retry
path around the failed load check in src/init.cpp lines 2095-2104, tear down the
existing chainstate resource graph so the loop can safely recreate node.mempool
and node.chainman. In src/node/chainstate.cpp lines 47-82, update the
replacement cleanup order to release chain_helper, the mempool connection,
llmq_ctx, dmnman, and evodb in reverse dependency order before destroying
dependents.
🧹 Nitpick comments (2)
src/test/validation_chainstatemanager_tests.cpp (1)

53-54: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Fix typographical error in comment.

📝 Proposed fix
-    // Initialize chain_helpper
+    // Initialize chain_helper
     node.chain_helper.reset();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/test/validation_chainstatemanager_tests.cpp` around lines 53 - 54,
Correct the misspelled “chain_helpper” in the initialization comment above
node.chain_helper.reset() to “chain_helper”.
src/test/util/setup_common.cpp (1)

328-330: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Hardcode the function name to avoid unhelpful __func__ output.

The __func__ macro inside a lambda expression will evaluate to operator(), not the enclosing function's name (LoadVerifyActivateChainstate). This results in an unhelpful log message. Consider hardcoding the function name to improve traceability.

📝 Proposed fix
-    std::tie(status, error) = VerifyLoadedChainstate(*Assert(m_node.chainman), options, [](bool bls_state) {
-            LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls_state);
+    std::tie(status, error) = VerifyLoadedChainstate(*Assert(m_node.chainman), options, [](bool bls_state) {
+            LogPrintf("LoadVerifyActivateChainstate: bls_legacy_scheme=%d\n", bls_state);
         });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/test/util/setup_common.cpp` around lines 328 - 330, Update the LogPrintf
call in the VerifyLoadedChainstate callback within LoadVerifyActivateChainstate
to use the enclosing function name explicitly instead of __func__. Preserve the
existing bls_state value and log format.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/test/util/setup_common.cpp`:
- Around line 404-409: Reorder teardown in the setup cleanup sequence so
m_node.mempool->DisconnectManagers() executes before m_node.llmq_ctx.reset().
Preserve the existing chain_helper and dmnman cleanup behavior, changing only
the ordering needed to disconnect mempool managers while the InstantSend/LLMQ
context remains valid.

---

Outside diff comments:
In `@src/init.cpp`:
- Around line 2095-2104: Before setting fReindex in the retry path around the
failed load check in src/init.cpp lines 2095-2104, tear down the existing
chainstate resource graph so the loop can safely recreate node.mempool and
node.chainman. In src/node/chainstate.cpp lines 47-82, update the replacement
cleanup order to release chain_helper, the mempool connection, llmq_ctx, dmnman,
and evodb in reverse dependency order before destroying dependents.

---

Nitpick comments:
In `@src/test/util/setup_common.cpp`:
- Around line 328-330: Update the LogPrintf call in the VerifyLoadedChainstate
callback within LoadVerifyActivateChainstate to use the enclosing function name
explicitly instead of __func__. Preserve the existing bls_state value and log
format.

In `@src/test/validation_chainstatemanager_tests.cpp`:
- Around line 53-54: Correct the misspelled “chain_helpper” in the
initialization comment above node.chain_helper.reset() to “chain_helper”.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1418401a-d0ad-4ee0-8d87-ac762aed5f1c

📥 Commits

Reviewing files that changed from the base of the PR and between ca2912d and 4a49ad2.

📒 Files selected for processing (9)
  • src/bitcoin-chainstate.cpp
  • src/init.cpp
  • src/llmq/options.h
  • src/llmq/signing.h
  • src/node/chainstate.cpp
  • src/node/chainstate.h
  • src/test/util/setup_common.cpp
  • src/test/util/setup_common.h
  • src/test/validation_chainstatemanager_tests.cpp
💤 Files with no reviewable changes (2)
  • src/llmq/signing.h
  • src/test/util/setup_common.h

Comment thread src/test/util/setup_common.cpp Outdated

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary review — Codex only

The exact head 4bde03a and full review range were verified. The final tree contains one behavior-changing Dash adaptation, and the commit stack contains an intermediate commit that cannot compile because its inlined chainstate code uses undeclared identifiers. The stack should be rewritten to keep every commit buildable and preserve the dash-chainstate option values.

Validated blockers were found in the Codex precheck. Sonnet is deferred until a fresh Codex revalidation clears the blocker gate.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (failed), gpt-5.6-sol — dash-core-commit-history (failed), gpt-5.6-sol — backport-reviewer (failed), gpt-5.6-sol — general (failed), gpt-5.6-sol — dash-core-commit-history (failed), gpt-5.6-sol — backport-reviewer (failed), gpt-5.6-sol — general (completed), gpt-5.6-sol — dash-core-commit-history (completed), gpt-5.6-sol — backport-reviewer (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet: not run (deferred by blocker gate)

🔴 1 blocking | 🟡 1 suggestion(s)

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/node/chainstate.cpp`:
- [BLOCKING] src/node/chainstate.cpp:78-80: Fold the build-restoring chainstate changes into the refactor
  Commit 171e0361b95 inlines DashChainstateSetup into LoadChainstate but passes the undeclared identifiers dash_dbs_in_memory, fReset, fReindexChainState, bls_threads, worker_count, max_recsigs_age, and mempool. Commit 4a49ad20725 later replaces them with ChainstateLoadOptions members, confirming that 171e0361b95 cannot compile independently. Fold those build-restoring changes into the refactor so every permanent commit remains buildable and usable for bisecting.

In `src/bitcoin-chainstate.cpp`:
- [SUGGESTION] src/bitcoin-chainstate.cpp:110-118: Incorrect transformation: dash-chainstate option values are not preserved
  Before this range, dash-chainstate explicitly set bls_threads, worker_count, and max_recsigs_age to 1, preserving the arguments used before the bitcoin#25308 parameter-to-options refactor. This change removes those assignments and inherits defaults of 0 BLS-check threads, a hardware-dependent worker count between 1 and 4, and a recovered-signature age of 604800 seconds. That changes the executable's behavior even though the backport only requires changing how the values are passed. Keep the three explicit values unless this behavioral change is proposed and justified separately.

Comment thread src/node/chainstate.cpp
Comment thread src/bitcoin-chainstate.cpp
@knst
knst requested review from PastaPastaPasta and UdjinM6 July 17, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants