Skip to content

fix: Qt wallet mint fails on fragmented UTXOs — missing auto-consolidation#396

Open
JohnnyLawDGB wants to merge 1 commit intoDigiByte-Core:feature/digidollar-v1from
JohnnyLawDGB:fix/qt-mint-utxo-consolidation
Open

fix: Qt wallet mint fails on fragmented UTXOs — missing auto-consolidation#396
JohnnyLawDGB wants to merge 1 commit intoDigiByte-Core:feature/digidollar-v1from
JohnnyLawDGB:fix/qt-mint-utxo-consolidation

Conversation

@JohnnyLawDGB
Copy link
Copy Markdown

Summary

  • Bug: Qt GUI mints fail with "Too many small UTXOs" when the wallet has many coinbase-sized UTXOs (~1,078 DGB each), because BuildMintTransaction enforces a 400-input limit (~431,400 DGB max) and the Qt path had no consolidation fallback
  • Root cause: PR fix: auto-consolidate fragmented UTXOs when minting DigiDollar #391 added UTXO auto-consolidation to the RPC mintdigidollar handler (src/rpc/digidollar.cpp:983-1111) but the Qt wallet's mintDigiDollar (src/qt/walletmodel.cpp) was never updated with the same logic — it called BuildMintTransaction once and returned the error directly on failure
  • Fix: Port the identical multi-pass consolidation logic (1400 inputs/pass, 10 max passes) into the Qt mint path, so GUI users get the same transparent consolidation-then-retry behavior as RPC users

Reproduction (reported by Aussie and DanGB on RC29 testnet)

Mint Amount Collateral Needed 400-Input Capacity Result
$100 DD (tier 0) ~231,000 DGB ~431,400 DGB Pass
$200 DD (tier 0) ~462,000 DGB ~431,400 DGB Fail
$300 DD (tier 0) ~694,000 DGB ~431,400 DGB Fail

DanGB has 11M tDGB across thousands of ~1,078 DGB coinbase UTXOs. Aussie has a similar distribution. Both confirmed $100 works but $200+ fails in Qt. The RPC path would have auto-consolidated and succeeded.

How it works

  1. BuildMintTransaction attempts the mint — if it fails with "Too many small UTXOs":
  2. Check total balance covers collateral requirement
  3. Multi-pass loop: sweep up to 1400 UTXOs per pass into a single consolidation output (wallet change address), broadcast each consolidation tx, refresh the UTXO set
  4. Single-pass fallback: if total UTXOs <= 1400, one consolidation tx suffices
  5. Retry BuildMintTransaction with the consolidated UTXO set

Test plan

  • Qt wallet mint with >400 small UTXOs now auto-consolidates and succeeds
  • Qt wallet mint with <400 UTXOs still works without consolidation (no regression)
  • RPC mintdigidollar behavior unchanged
  • Consolidation tx appears in wallet history
  • Error message shown if total balance truly insufficient after consolidation attempt

🤖 Generated with Claude Code

The RPC mintdigidollar handler had auto-consolidation logic (PR DigiByte-Core#391)
that detects when a mint fails due to UTXO fragmentation (>400 inputs
needed) and automatically consolidates UTXOs before retrying. The Qt
wallet's mintDigiDollar in walletmodel.cpp was missing this logic
entirely — it called BuildMintTransaction once and returned the error
on failure.

This caused Qt GUI users with many small coinbase UTXOs (e.g. ~1,078
DGB each from mining) to fail mints that required more than ~431,400
DGB (400 inputs * ~1,078 DGB), while the same mint via RPC would
succeed. Reported by Aussie and DanGB on RC29 testnet.

Port the multi-pass consolidation from src/rpc/digidollar.cpp into the
Qt mint path with identical parameters (1400 inputs/pass, 10 max
passes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant