-
Notifications
You must be signed in to change notification settings - Fork 330
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
transactions
method should only return relevant transactions
#1779
transactions
method should only return relevant transactions
#1779
Conversation
2df73bf
to
3fe2bb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 3fe2bb0
Concept ACK! Reminds me of #1239, and should probably close it once it gets in. Edit: just noticed Evan you'd already linked the issue up. Cheers! |
I added 75fae3e to verify only relevant transactions are returned. If there's a better way to test this feel free to replace or change this commit. I also re-based on master to pickup the CI fixes in #1776 and fixed typos that @oleonardolima found. |
ca38f17
to
488c722
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 75fae3e
Also update documentation.
488c722
to
75fae3e
Compare
I wonder if another thorough testing approach would be explicitly creating a new tx sending from A -> B, RBF it, and see that it's not being returned as relevant now, or that would still be relevant ? Does that make sense, or am I missing a point here ? (I guess same is being achieved in a simpler approach) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 75fae3e
IMO, a transaction
|
The scenario I had in mind is when we have a new version of electrum or esplora that also retrieves transactions that have double spent a utxo that we received in an unconfirmed tx. Those "foreign" tx don't have any scripts that are relevant to our wallet but still need to be in our wallet to invalidate our unconfirmed (double spent) tx. My test doesn't repro all the details of this scenario but at least shows that a not relevant tx can be added to the tx_graph and will be excluded from |
In this RBF scenario I think |
Is TxGraph monotonic? If so I agree that |
tACK 75fae3e Would be good to add a test fot the RBF scenario as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 75fae3e
I had this scenario in mind when writing RBF (e.g RBF'ed by/to an external wallet/spk). Thanks, it's clearer now. |
…_relevant 6346536 test(wallet): small cleanups to test_wallet_transactions_relevant (Steve Myers) Pull request description: ### Description This cleans up the `test_wallet_transactions_relevant` test based on suggestions that didn't make it into #1779. ### Notes to the reviewers Also included a small use cleanup in wallet/mod. ### Changelog notice None. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: luisschwab: ACK 6346536 ValuedMammal: ACK 6346536 Tree-SHA512: f9604518d2b9bb5614385a053efb03d53311f359626d45270f3648209ab0e31ba966995f842fff1c35f0c83848c61f0976f91524a3f457c6cd85e3f0929f4a77
Fixes #1239
Description
Currently the behavior of
Wallet::transactions
is not well defined and unintuitive.The approach taken in this PR is to make
Wallet::transactions
return what most wallets would like the caller to see (i.e. transactions that are part of the canonical history and spend from/to a tracked spk). A.k.a make the method more restrictive.Documentation is updated to refer the caller to the underlying
bdk_chain
structures for any over usecase.After #1765 gets merged, the behavior of
Wallet::transactions
will become even more unintuitive. Refer to #1765 (review).Notes to the reviewers
Why not have multiple methods in
Wallet
that return different sets of transactions?I think it's better to only provide common usecase histories from
Wallet
and I can only think of one.Changelog notice
Wallet::transactions
to only include "relevant" transactions.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing