Merge bitcoindevkit/bdk#763: Fix Wallet::descriptor_checksum
to actually return the checksum
af0b3698c691cd08ece9ae201cc9699f0d57acc8 Fix `Wallet::descriptor_checksum` to actually return the checksum (志宇) Pull request description: ### Description `Wallet::descriptor_checksum` should return the checksum, not the descriptor without the checksum. ### Notes to the reviewers Please merge. ### Changelog notice Fix `Wallet::descriptor_checksum` to actually return the descriptor checksum. ### 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 #### Bugfixes: ~* [ ] This pull request breaks the existing API~ * [x] 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: danielabrozzoni: ACK af0b3698c691cd08ece9ae201cc9699f0d57acc8 - I run the test you added with the old code, and verified that the bug was there. I then run the test (with a few more dbg!() expressions) and manually verified that the problem is fixed. notmandatory: ACK af0b3698c691cd08ece9ae201cc9699f0d57acc8 Tree-SHA512: 64a5b1f4708db6f6dcff2f6ef5e0a4c7d206e764d7602ea803c8cc002410326eb59eee770d9c91694dfbf07193ee3ff6bfe163bcbb3506cd7b2a6b59814a3e5c
This commit is contained in:
commit
a8cf34e809
@ -1842,7 +1842,7 @@ where
|
||||
.to_string()
|
||||
.split_once('#')
|
||||
.unwrap()
|
||||
.0
|
||||
.1
|
||||
.to_string()
|
||||
}
|
||||
}
|
||||
@ -1938,6 +1938,22 @@ pub(crate) mod test {
|
||||
// OP_PUSH.
|
||||
const P2WPKH_FAKE_WITNESS_SIZE: usize = 106;
|
||||
|
||||
#[test]
|
||||
fn test_descriptor_checksum() {
|
||||
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
|
||||
let checksum = wallet.descriptor_checksum(KeychainKind::External);
|
||||
assert_eq!(checksum.len(), 8);
|
||||
|
||||
let raw_descriptor = wallet
|
||||
.descriptor
|
||||
.to_string()
|
||||
.split_once('#')
|
||||
.unwrap()
|
||||
.0
|
||||
.to_string();
|
||||
assert_eq!(get_checksum(&raw_descriptor).unwrap(), checksum);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_funded_wallet_balance() {
|
||||
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
|
||||
|
Loading…
x
Reference in New Issue
Block a user