fix: purge confirmed txs from Dandelion stempool on block connect#392
Open
JohnnyLawDGB wants to merge 2 commits intoDigiByte-Core:feature/digidollar-v1from
Open
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>
When a block is connected, removeForBlock() was called on the mempool but not the stempool. This caused confirmed transactions to remain in the stempool indefinitely as phantom ancestors, inflating ancestor counts for any new stempool transactions until they hit the 25-ancestor limit and were rejected with "too-long-mempool-chain". Also adds stempool cleanup during DisconnectTip reorg path for consistency with all other mempool/stempool cleanup code paths. Fixes: Dandelion stempool ancestor leak (Bug DigiByte-Core#7) 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
removeForBlock()was called onm_mempoolbut notm_stempoolinConnectTip(). Confirmed transactions remained in the stempool indefinitely as phantom ancestors.too-long-mempool-chainrejection. Affects all platforms (Windows Qt, Linux daemon, Linux Desktop).m_stempool->removeForBlock()inConnectTip()andm_stempool->removeRecursive()inDisconnectTip(), matching all other mempool/stempool cleanup paths that already handle both pools correctly.Details
Every other cleanup path in
validation.cppalready mirrors operations between mempool and stempool:removeRecursiveduring reorg (line 324-325) ✅removeForReorg(line 396-397) ✅LimitMempoolSize(line 399-400) ✅removeForBlockinConnectTip(line 3483) ❌ ← this was the only one missingremoveRecursiveinDisconnectTip(line 3355) ❌ ← also missingThe workaround (
dandelion=0) disables Dandelion privacy entirely. This fix preserves full Dandelion++ privacy while keeping the stempool clean.Test plan
test_digibyte --run_test=dandelion_tests— 2/2 passtest_digibyte --run_test=validation_tests— 5/5 passtest_digibyte --run_test=mempool_tests— 6/6 passdandelion=1, send 30+ chained transactions, verify no "too-long-mempool-chain" errors after blocks confirm🤖 Generated with Claude Code