Skip to content

Commit af0b369

Browse files
committed
Fix Wallet::descriptor_checksum to actually return the checksum
1 parent b14e4ee commit af0b369

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/wallet/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ where
18421842
.to_string()
18431843
.split_once('#')
18441844
.unwrap()
1845-
.0
1845+
.1
18461846
.to_string()
18471847
}
18481848
}
@@ -1938,6 +1938,22 @@ pub(crate) mod test {
19381938
// OP_PUSH.
19391939
const P2WPKH_FAKE_WITNESS_SIZE: usize = 106;
19401940

1941+
#[test]
1942+
fn test_descriptor_checksum() {
1943+
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
1944+
let checksum = wallet.descriptor_checksum(KeychainKind::External);
1945+
assert_eq!(checksum.len(), 8);
1946+
1947+
let raw_descriptor = wallet
1948+
.descriptor
1949+
.to_string()
1950+
.split_once('#')
1951+
.unwrap()
1952+
.0
1953+
.to_string();
1954+
assert_eq!(get_checksum(&raw_descriptor).unwrap(), checksum);
1955+
}
1956+
19411957
#[test]
19421958
fn test_get_funded_wallet_balance() {
19431959
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());

0 commit comments

Comments
 (0)