-
Notifications
You must be signed in to change notification settings - Fork 411
fix(wallet)!: Improve test utilities #1658
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
fix(wallet)!: Improve test utilities #1658
Conversation
oleonardolima
left a comment
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.
Concept ACK
Although I didn't get it yet why the change, mentioned in the comment below.
d33116f to
771d7c1
Compare
insert_anchor_from_conf95c14a2 to
869d7e6
Compare
869d7e6 to
f5eeafd
Compare
|
Is this an API break change or something that should go in the 1.0-beta milestone? |
The common test utils are moved to a public `test_utils` module behind a new test-utils feature flag
- `get_funded_wallet` requires two descriptors - `get_funded_wallet_single` returns a single-descriptor wallet
f5eeafd to
1d61fde
Compare
|
I cherry picked some of the changes from #1644. The main difference here is removing |
Inserting unconfirmed txs can be done using the existing method `apply_unconfirmed_txs`. Also removed `insert_checkpoint`, as the API is unclear regarding where in the local chain the given block should connect. Analogs for these methods are found in `test_utils` module and are mainly used to facilitate testing.
This is no longer relevant as we direct callers to only insert tx into the wallet after a successful broadcast.
Not including a `seen_at` alongside the update means the unconfirmed txs of the update will not be considered to be part of the canonical history. Therefore, transactions created with this wallet may replace the update's unconfirmed txs (which is unintuitive behavior). Also updated the docs.
1d61fde to
b0dc3dd
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.
ACK b0dc3dd
|
This also fixes #1622 by removing functions that were only needed for testing. |
Follow up to #1643, refactor
insert_anchor_from_confto just insert an anchor of typeConfirmationBlockTimeNotes to the reviewers
The PR introduces a public
test_utilsmodule and "test-utils" cargo feature that exposes common helpers such asget_funded_wallet. Credit to #1492 for inspiring that idea. Usage of test utilities is enhanced overall, and tests are less dependent on problematic APIs that may be removed in the future.Changelog notice
bdk_wallet: Added "test-utils" feature flag that exposes common helpers for testing and developmentWallet::insert_tx,Wallet::insert_checkpoint,Wallet::unbroadcast_transactionsChecklists
All Submissions:
cargo fmtandcargo clippybefore committing