You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #661: Test: No address reuse for single descriptor
2c02a44 Test: No address reuse for single descriptor (志宇)
Pull request description:
### Description
Just a simple new test.
This test is to ensure there are no regressions when we later change
internal logic of `Wallet`. A single descriptor wallet should always get
a new address with `AddressIndex::New` even if we alternate grabbing
internal/external keychains.
I thought of adding this during work on #647
### 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:
danielabrozzoni:
tACK 2c02a44
rajarshimaitra:
tACK 2c02a44
Tree-SHA512: d065ae0979dc3ef7c26d6dfc19c88498e4bf17cc908e4f5677dcbf62ee59162e666cb00eb87b96d4c2557310960e3677eec7b6d907a5a4860cb7d2d74dba07b0
Copy file name to clipboardExpand all lines: src/wallet/mod.rs
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4499,6 +4499,34 @@ pub(crate) mod test {
4499
4499
);
4500
4500
}
4501
4501
4502
+
#[test]
4503
+
fntest_get_address_no_reuse_single_descriptor(){
4504
+
usecrate::descriptor::template::Bip84;
4505
+
use std::collections::HashSet;
4506
+
4507
+
let key = bitcoin::util::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy").unwrap();
4508
+
let wallet = Wallet::new(
4509
+
Bip84(key,KeychainKind::External),
4510
+
None,
4511
+
Network::Regtest,
4512
+
MemoryDatabase::default(),
4513
+
)
4514
+
.unwrap();
4515
+
4516
+
letmut used_set = HashSet::new();
4517
+
4518
+
(0..3).for_each(|_| {
4519
+
let external_addr = wallet.get_address(AddressIndex::New).unwrap().address;
0 commit comments