Skip to content

Commit 91d7d3c

Browse files
committed
Merge #1658: fix(wallet)!: Improve test utilities
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
2 parents dc0511f + b0dc3dd commit 91d7d3c

File tree

7 files changed

+402
-521
lines changed

7 files changed

+402
-521
lines changed

crates/wallet/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ all-keys = ["keys-bip39"]
3535
keys-bip39 = ["bip39"]
3636
rusqlite = ["bdk_chain/rusqlite"]
3737
file_store = ["bdk_file_store"]
38+
test-utils = ["std"]
3839

3940
[dev-dependencies]
4041
lazy_static = "1.4"
4142
assert_matches = "1.5.0"
4243
tempfile = "3"
4344
bdk_chain = { path = "../chain", features = ["rusqlite"] }
44-
bdk_wallet = { path = ".", features = ["rusqlite", "file_store"] }
45+
bdk_wallet = { path = ".", features = ["rusqlite", "file_store", "test-utils"] }
4546
bdk_file_store = { path = "../file_store" }
4647
anyhow = "1"
4748
rand = "^0.8"

crates/wallet/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ pub extern crate serde_json;
2828
pub mod descriptor;
2929
pub mod keys;
3030
pub mod psbt;
31+
#[cfg(feature = "test-utils")]
32+
pub mod test_utils;
3133
mod types;
3234
mod wallet;
3335

0 commit comments

Comments
 (0)