Skip to content

Commit 2703cc6

Browse files
committed
Merge #1417: test(wallet): add thread safety test
db47347 test(wallet): add thread safety test (Rob N) Pull request description: ### Description `Wallet` auto-implements `Send` and `Sync` after removing the generic. This test is a compile time error if there are changes to `Wallet` in the future that make it unsafe to send between threads. See #1387 for discussion. ### 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 #### New Features: * [x] I've added tests for the new feature * [ ] I've added docs for the new feature #### Bugfixes: * [ ] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR ACKs for top commit: evanlinjin: ACK db47347 Tree-SHA512: 490e666bc503f15286268db7e5e2f75ee44ad2f80251d6f7a01af2a435023b87607eee33623712433ea8d27511be63c6c1e9cad4159b3fe66a4644cfa9e344fb
2 parents fbe1782 + db47347 commit 2703cc6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/bdk/tests/wallet.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3854,3 +3854,9 @@ fn test_tx_cancellation() {
38543854
.unwrap();
38553855
assert_eq!(change_derivation_4, (KeychainKind::Internal, 2));
38563856
}
3857+
3858+
#[test]
3859+
fn test_thread_safety() {
3860+
fn thread_safe<T: Send + Sync>() {}
3861+
thread_safe::<Wallet>(); // compiles only if true
3862+
}

0 commit comments

Comments
 (0)