Skip to content

fix: skip unspendable outputs in BuildSimpleUtxoMap - #7266

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
UdjinM6:fix/evo-test-flakiness
Aug 3, 2026
Merged

fix: skip unspendable outputs in BuildSimpleUtxoMap#7266
PastaPastaPasta merged 1 commit into
dashpay:developfrom
UdjinM6:fix/evo-test-flakiness

Conversation

@UdjinM6

@UdjinM6 UdjinM6 commented Apr 3, 2026

Copy link
Copy Markdown

Issue being fixed or feature implemented

Skip OP_RETURN and other unspendable outputs in BuildSimpleUtxoMap in both evo_deterministicmns_tests and block_reward_reallocation_tests. Dash coinbases can include OP_RETURN outputs (credit pool payments when V20+MN_RR are active) which should never be selected as transaction inputs.

What was done?

How Has This Been Tested?

Breaking Changes

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)

@UdjinM6 UdjinM6 added this to the 24 milestone Apr 3, 2026
@github-actions

github-actions Bot commented Apr 3, 2026

Copy link
Copy Markdown

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@thepastaclaw

thepastaclaw commented Apr 3, 2026

Copy link
Copy Markdown

✅ Final review complete — no blockers (commit b6ce527)

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown

Walkthrough

Two test files were modified to improve test stability and correctness. The BuildSimpleUtxoMap function in both test files was updated to filter out unspendable outputs, preventing them from being selected as funding inputs during test execution. Additionally, evo_deterministicmns_tests.cpp was enhanced with includes for transaction index utilities and a synchronization checkpoint in the FuncVerifyDB function to ensure the transaction index is fully synchronized before dependent operations execute.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change to skip unspendable outputs in BuildSimpleUtxoMap.
Description check ✅ Passed The description accurately explains the unspendable-output fix and the related txindex synchronization change.
✨ 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.

@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.

Code Review

Clean test fix addressing two independent flakiness issues. (1) BuildSimpleUtxoMap now skips OP_RETURN unspendable outputs that were polluting the UTXO map in both block_reward_reallocation_tests and evo_deterministicmns_tests — these outputs would cause later spend attempts to fail with 'missing inputs'. (2) FuncVerifyDB adds IndexWaitSynced(*g_txindex) after ProcessNewBlock to ensure the txindex has indexed the collateral transaction before CreateProUpRevTx looks it up via GetTransaction. Both fixes are correct and minimal. No issues found.

Reviewed commit: 74056e9

@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.

Code Review

Test-only flake fix at SHA 74056e9 — both fixes are correct and narrowly scoped. The IsUnspendable() filter prevents BuildSimpleUtxoMap from selecting OP_RETURN credit-pool outputs in V20+MN_RR coinbases, and the IndexWaitSynced call ensures g_txindex has indexed the block before CreateProUpRevTx's GetTransaction lookup. Both Claude and Codex independently verified no issues.

Reviewed commit: 74056e9

Fresh dispatcher run for this queue item. A same-SHA review already existed, so this records the fresh verification without duplicating inline threads.

Code Review

Reviewed commit: 74056e9

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

Dash coinbase transactions can include OP_RETURN outputs (e.g. credit
pool payments when V20+MN_RR are active). BuildSimpleUtxoMap was adding
these to the UTXO map, allowing SelectUTXOs to pick them as transaction
inputs which would then fail signature verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@UdjinM6 UdjinM6 changed the title fix: resolve flaky verify_db_legacy test and skip unspendable outputs in test UTXO map fix: skip unspendable outputs in BuildSimpleUtxoMap Aug 2, 2026
@UdjinM6
UdjinM6 force-pushed the fix/evo-test-flakiness branch from 74056e9 to b6ce527 Compare August 2, 2026 00:08

@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.

Final validation — Codex + Sonnet

The current rebased patch correctly excludes unspendable outputs from both BuildSimpleUtxoMap test helpers, matching CCoinsViewCache::AddCoin behavior and preventing OP_RETURN outputs from being selected as transaction inputs. The prior clean result remains valid: the earlier txindex synchronization workaround is obsolete because the current base signs directly from returned Coin data without GetTransaction or g_txindex. No correctness, security, consensus, or test-coverage issues were found.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed), gpt-5.6-sol — dash-core-commit-history (completed)
  • Verifier: gpt-5.6-sol — final-verifier (fallback)
  • Sonnet reviewers: claude-sonnet-5 — general (completed), claude-sonnet-5 — dash-core-commit-history (failed), claude-sonnet-5 — dash-core-commit-history (completed)

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utACK b6ce527

@PastaPastaPasta
PastaPastaPasta merged commit 0017f50 into dashpay:develop Aug 3, 2026
46 of 47 checks passed
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

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.

3 participants