Skip to content

Undetected double-spent #1740

@ErikDeSmedt

Description

@ErikDeSmedt

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions