Skip to content

Applied unconfirmed transactions need to be pruned after some time #1666

@tnull

Description

@tnull

Describe the bug
In the last BDK Lib call we discussed that likely Wallet::apply_unconfirmed_txs won't ever forget the applied transactions. This is a bug as there is no guarantee that transactions might not eventually be dropped from the mempool, which would leave the wallet with unspendable UTXOs/funds, at least until the wallet is restarted and the state is lost.

Expected behavior
We need a way (read: prune_applied_transactions API or similar) to prune the applied transactions, preferable after a configurable threshold after the last seen, or after some number of blocks. Incidentally this would likely also resolve bitcoindevkit/bdk_wallet#166, as locking UTXOs prior to broadcast and locking UTXOs based on the ephemeral mempool state is more or less the same thing.

Additional context
We also discussed in the call that the difference between apply_unconfirmed_txs and insert_tx is unclear, as @stevenroose previously wondered in #1642 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions