Skip to content

Commit 86863d2

Browse files
committed
test: add BIP32 and BIP44 tests for short invalid xpub parsing in Bitcoin Cash
1 parent dc39220 commit 86863d2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/bip32_vectors.rs

+8
Original file line numberDiff line numberDiff line change
@@ -245,5 +245,13 @@ mod tests {
245245
"Multiple BIP32 addresses do not match expected"
246246
);
247247
}
248+
249+
/// Test BIP32 Bitcoin Cash xpub parsing with a short invalid xpub and checks if an error is returned
250+
#[test]
251+
fn test_bip32_bhc_short_invalid_xpub() {
252+
let invalid_xpub = "xpub123";
253+
let result = Xpub::from_base58(invalid_xpub, CoinType::BitcoinCash);
254+
assert!(result.is_err(), "Short xpub fail for BIP32 Bitcoin Cash");
255+
}
248256
}
249257
}

tests/bip44_vectors.rs

+8
Original file line numberDiff line numberDiff line change
@@ -390,5 +390,13 @@ mod test {
390390
)
391391
}
392392
}
393+
394+
/// Test BIP44 Bitcoin Cash xpub parsing with a short invalid xpub and checks if an error is returned
395+
#[test]
396+
fn test_bip44_bhc_short_invalid_xpub() {
397+
let invalid_xpub = "xpub123";
398+
let result = Xpub::from_base58(invalid_xpub, CoinType::BitcoinCash);
399+
assert!(result.is_err(), " Short xpub fail for BIP44 Bitcoin Cash");
400+
}
393401
}
394402
}

0 commit comments

Comments
 (0)