fix: auto-consolidate fragmented UTXOs when minting DigiDollar#391
Open
JohnnyLawDGB wants to merge 1 commit intoDigiByte-Core:feature/digidollar-v1from
Open
fix: auto-consolidate fragmented UTXOs when minting DigiDollar#391JohnnyLawDGB wants to merge 1 commit intoDigiByte-Core:feature/digidollar-v1from
JohnnyLawDGB wants to merge 1 commit intoDigiByte-Core:feature/digidollar-v1from
Conversation
When a wallet has too many small UTXOs (>400) to cover collateral in a single transaction, mintdigidollar now automatically creates a consolidation transaction using the wallet's standard coin selection, then retries the mint using the consolidated output. This fixes the "Too many small UTXOs" error that miners and pool operators encounter when their wallet contains hundreds of small mining reward UTXOs that individually don't cover the collateral requirement within the 400-input transaction limit. The consolidation is transparent — the response includes consolidation_txid and utxos_consolidated fields when auto- consolidation was performed. Both the consolidation and mint transactions are broadcast together and chain in the mempool. Tested with 500 x 600 DGB UTXOs (300,000 DGB total) where tier 0 minting requires ~246,000 DGB collateral. Without this fix, the mint fails because 400 x 600 = 240,000 < 246,000. With this fix, the wallet auto-consolidates and the mint succeeds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mintdigidollarfails due to UTXO fragmentation (>400 small UTXOs), the RPC now automatically creates a consolidation transaction and retries the mintconsolidation_txidandutxos_consolidatedfields when auto-consolidation occurredRoot Cause
SelectCoinsintxbuilder.cpphas aMAX_TX_INPUTS = 400limit to keep transactions underMAX_STANDARD_TX_WEIGHT. When a wallet has many small UTXOs (e.g., 500 x 600 DGB from mining), the top 400 UTXOs may not cover the collateral requirement (e.g., 400 × 600 = 240,000 < 246,000 needed for tier 0).Fix
In the
mintdigidollarRPC handler (src/rpc/digidollar.cpp):BuildMintTransactionCreateTransaction(which has its own weight-aware coin selection)BuildMintTransactionwith the new UTXO setTest plan
mintdigidollar 10000 0failed with "Too many small UTXOs"consolidation_txidandutxos_consolidated: true🤖 Generated with Claude Code