Skip to content

Commit

Permalink
Merge #1658: fix(wallet)!: Improve test utilities
Browse files Browse the repository at this point in the history
b0dc3dd feat(wallet)!: make `seen_at` mandatory for `Wallet::apply_update_at` (志宇)
00c568d revert(wallet)!: rm `Wallet::unbroadcast_transactions` (志宇)
200a16d fix(wallet)!: delete method `insert_tx` (valued mammal)
ab27884 test(wallet): improve usage of test utils (valued mammal)
9bdf4cb chore: fix imports (valued mammal)
28d8061 test(wallet): fix test descriptor getters (valued mammal)
3135e29 test(wallet): add helpers to `test_utils` (valued mammal)
823bb39 feat(wallet): add module `test_utils` (valued mammal)
297bd9a test(wallet): refactor helper `insert_anchor_from_conf` (valued mammal)

Pull request description:

  Follow up to #1643, refactor `insert_anchor_from_conf` to just insert an anchor of type `ConfirmationBlockTime`

  ### Notes to the reviewers

  The PR introduces a public `test_utils` module and "test-utils" cargo feature that exposes common helpers such as `get_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 development
  - Removed methods `Wallet::insert_tx`, `Wallet::insert_checkpoint`, `Wallet::unbroadcast_transactions`

  ### 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
  * [x] I've added docs for the new feature
  * [x] This pull request breaks the existing API

Top commit has no ACKs.

Tree-SHA512: 561757595c65b4531dbf8b81f44387af6ac60114ecca493693cd975188741b5ff7b75a0dcf1dafc9d5750566baad81c644e7463c3c412a8331ad73de29601016
  • Loading branch information
notmandatory committed Nov 12, 2024
2 parents dc0511f + b0dc3dd commit 91d7d3c
Show file tree
Hide file tree
Showing 7 changed files with 402 additions and 521 deletions.
3 changes: 2 additions & 1 deletion crates/wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ all-keys = ["keys-bip39"]
keys-bip39 = ["bip39"]
rusqlite = ["bdk_chain/rusqlite"]
file_store = ["bdk_file_store"]
test-utils = ["std"]

[dev-dependencies]
lazy_static = "1.4"
assert_matches = "1.5.0"
tempfile = "3"
bdk_chain = { path = "../chain", features = ["rusqlite"] }
bdk_wallet = { path = ".", features = ["rusqlite", "file_store"] }
bdk_wallet = { path = ".", features = ["rusqlite", "file_store", "test-utils"] }
bdk_file_store = { path = "../file_store" }
anyhow = "1"
rand = "^0.8"
Expand Down
2 changes: 2 additions & 0 deletions crates/wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub extern crate serde_json;
pub mod descriptor;
pub mod keys;
pub mod psbt;
#[cfg(feature = "test-utils")]
pub mod test_utils;
mod types;
mod wallet;

Expand Down
Loading

0 comments on commit 91d7d3c

Please sign in to comment.