Repository navigation
fix(sp): mark silent payment coins spent elsewhere as spent - #184
Open
thevaibhav-dixit wants to merge 1 commit into
Open
thevaibhav-dixit wants to merge 1 commit into
thevaibhav-dixit wants to merge 1 commit into
Conversation
A restored wallet, or one whose coins were spent from another device, kept counting those silent payment coins as unspent: the wallet only learned about spends it broadcast itself. After each scan, check each unspent SP coin's address on Electrum and mark it spent when Electrum knows the funding transaction but no longer lists the coin as unspent. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
Problem
Shroud only learns that a silent payment coin was spent when this device broadcasts the spending transaction. The indexer scan finds incoming SP coins, but once a coin is found it is never re-checked.
So when a wallet is restored on a new device, or a coin is spent from another device, Shroud keeps treating those coins as unspent:
Fix
Every SP coin lives at its own taproot address. After each scan, Shroud asks Electrum about the addresses of the SP coins it believes are unspent:
This is a temporary fix inside the app. It doesn't change the indexer or anything the app requests from it.
Testing
tests/unit/sp-spent-check.test.ts: marks only coins Electrum knows about but no longer lists as unspent, and changes nothing when Electrum failsbip352,scan-by-txid,sp-builder,birth-height)tsc --noEmitandeslintclean🤖 Generated with Claude Code