Repository navigation
fix: MemPool::get_unconfirmed_utxos: skip outputs spent by mempool txs - #56
Open
giaki3003 wants to merge 4 commits into
Conversation
Bug: w3-20260630-1952-kimiclaw-confirm-openclaw- (primary) Finding: findings/20260630-1952-kimiclaw-confirm-openclaw-plain-bitassets-dutch-auction-dust-bid-drain.md Severity: R4-T1 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit b3baea9)
…ty check on a mis-assigned n_unique_bitasset_outputs variable (filled from spent BitAsset INPUTS via unique_spent_bitassets() instead of the computed-but-unused bitasset_outputs() count), so a normal LP-redemption burn is deterministically rejected by block validation with Error::Amm(InvalidBurn) Bug: w3-20260611-0220-bitassets-amm-burn-validat (primary) Finding: findings/20260611-0220-bitassets-amm-burn-validator-counts-spent-bitassets-not-outputs-rejects-normal-burn.md Severity: R4-T2 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit caeb6d5)
… block Bug: w3-20260702-2346-kimiclaw-confirm-glmclaw-p (primary) Finding: findings/20260702-2346-kimiclaw-confirm-glmclaw-plain-bitassets-amm-swap-prevalidate-connect-gap.md Severity: R4-T2 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit 574f79d)
…s as UTXOs Bug: w3-20260703-1444-openclaw-confirm-kimiclaw- (primary) Finding: findings/20260703-1444-openclaw-confirm-kimiclaw-plain-bitassets-mempool-unconfirmed-utxo-spent-blindness.md Severity: R4-T4 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit e9daa80)
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.
What's wrong
MemPool::get_unconfirmed_utxos(lib/mempool.rs) collects every output of every mempool transaction that pays the requested address, without consulting the mempool's ownspent_utxosindex. When one mempool transaction spends another's unconfirmed output, that output is still reported as a UTXO. The result reaches users throughNode::get_unconfirmed_utxos_by_addresses, themy_unconfirmed_utxosRPC, and the wallet's unconfirmed UTXO set, so unconfirmed balances are overstated, and a caller that treats the result as spendable can build a transaction thatMemPool::putthen rejects withUtxoDoubleSpent.The fix
Replaces the final
collect()with atry_foldthat looks each outpoint up inself.spent_utxos, in the same read transaction, and drops those already spent by another mempool transaction.No regression test in this patch; happy to add one if you'd like it covered.
Finding report (access-controlled): https://giaki3003.tech/#/findings/20260703-1444-openclaw-confirm-kimiclaw-plain-bitassets-mempool-unconfirmed-utxo-spent-blindness
Part of a short series for this repo (fix 4 of 4); builds on #55, so it reads best merged after that one. Happy to rebase or split if you'd prefer them independent.