Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undetected double-spent #1740

Open
ErikDeSmedt opened this issue Nov 21, 2024 · 1 comment
Open

Undetected double-spent #1740

ErikDeSmedt opened this issue Nov 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ErikDeSmedt
Copy link

Describe the bug

  1. Alice has an empty wallet
  2. Alice receives a transaction (called tx1a) from Bob and observes it in the mempool.
  3. Bob double-spends tx1a creating tx1b
  4. A block is mined containing tx1b
  5. Alice observes tx1b in a block.

Alice will still consider tx1a as a pending transaction.

To Reproduce
See this https://github.com/ErikDeSmedt/bdk-gists/blob/master/tests/wallet.rs

Expected behavior

I would expect that Alice her wallet wouldn't use tx1a anymore. The output

  • should not be used for coin-selection
  • should not be part of the balance (untrusted_pending)

Build environment

  • BDK tag/commit: 1.0.0-beta.5
  • OS+version: debian
  • Rust/Cargo version: cargo 1.79.0 (ffa9cf99a 2024-06-03)

Additional context

I discovered this bug in a test-case where the entire wallet was unusable.

@ErikDeSmedt ErikDeSmedt added the bug Something isn't working label Nov 21, 2024
@notmandatory notmandatory added this to BDK Nov 21, 2024
@notmandatory notmandatory moved this to Todo in BDK Nov 21, 2024
@notmandatory notmandatory modified the milestone: 1.0.0-beta Nov 21, 2024
@ValuedMammal
Copy link
Contributor

tx1b is not discovered on the second sync because it's not "relevant" to alice's wallet, so you'd have to manually insert it similar to tx1a for it to be seen as conflicting (I wonder if this situation is alleviated by using compact block filters).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

3 participants