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

User should have a way to know that a transaction changed its state #1350

Open
danielabrozzoni opened this issue Feb 16, 2024 · 3 comments
Open
Labels
api A breaking API change discussion There's still a discussion ongoing module-blockchain module-wallet

Comments

@danielabrozzoni
Copy link
Member

danielabrozzoni commented Feb 16, 2024

Right now if users want to know if a transaction was removed from the chain, or dropped from the mempool, they need to compare two versions of list_unspent obtained in different moments.

We should investigate if we can provide some method to do this on our end.

The use case for this is: a user just synced with the backend, wants to know which transactions disappeared.

Edit: this can be further generalized to be a way to notify users when transactions/utxos change state (confirmation, drop from mempool, reorg, but also replacement, etc)

@danielabrozzoni danielabrozzoni changed the title User should have a way to know that a transaction was removed from the mempool User should have a way to know that a transaction changed its state Feb 16, 2024
@evanlinjin
Copy link
Member

Right now if users want to know if a transaction was removed from the chain, or dropped from the mempool, they need to compare two versions of list_unspent obtained in different moments.

Module Data type Method(s) to compare state with
bdk_chain UTXOs TxGraph::filter_chain_unspents, TxGraph::try_filter_chain_unspents
bdk_chain Transactions TxGraph::list_chain_txs, TxGraph::try_list_chain_txs
bdk_wallet UTXOs Wallet::list_unspent
bdk_wallet Transactions Wallet::transactions

@LLFourn
Copy link
Contributor

LLFourn commented Feb 19, 2024

Before introducing a way of notifying users of a state change we should have a way of determining the current state of a transaction more precisely. Right now we only have canonical (confirmed or unconfirmed) or not canonical. This is not enough -- I want to know why a transaction is non-canonical. This is usually a conflict was confirmed or seen more recently.

In terms of listing I think we should have a way of listing all transactions in the order they were first seen (see: #1333) and what the current state of them is. You usually don't want to just forget about a transaction when you've broadcast it. RBF happens infrequently enough it's better to leave it in the app's transaction list and just indicate that the tx was replaced by another.

@nondiremanuel nondiremanuel added this to the 1.0.0-alpha milestone Feb 27, 2024
@nondiremanuel nondiremanuel added discussion There's still a discussion ongoing api A breaking API change labels Feb 27, 2024
@notmandatory
Copy link
Member

A potentially big change I think we should push to 2.0 milestone.

@nondiremanuel nondiremanuel removed this from the 1.0.0-alpha milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change discussion There's still a discussion ongoing module-blockchain module-wallet
Projects
Status: Discussion
Development

No branches or pull requests

5 participants