mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-01-30 15:32:14 +00:00
parent
30660e1d1c
commit
e7b5329e95
@ -183,11 +183,95 @@ mod tests {
|
||||
use zcash_primitives::{
|
||||
jubjub::edwards,
|
||||
primitives::{Diversifier, PaymentAddress},
|
||||
zip32::ExtendedSpendingKey,
|
||||
};
|
||||
|
||||
use super::{decode_payment_address, encode_payment_address};
|
||||
use super::{
|
||||
decode_extended_full_viewing_key, decode_extended_spending_key, decode_payment_address,
|
||||
encode_extended_full_viewing_key, encode_extended_spending_key, encode_payment_address,
|
||||
};
|
||||
use crate::constants;
|
||||
|
||||
#[test]
|
||||
fn extended_spending_key() {
|
||||
let extsk = ExtendedSpendingKey::master(&[0; 32][..]);
|
||||
|
||||
let encoded_main = "secret-extended-key-main1qqqqqqqqqqqqqq8n3zjjmvhhr854uy3qhpda3ml34haf0x388z5r7h4st4kpsf6qysqws3xh6qmha7gna72fs2n4clnc9zgyd22s658f65pex4exe56qjk5pqj9vfdq7dfdhjc2rs9jdwq0zl99uwycyrxzp86705rk687spn44e2uhm7h0hsagfvkk4n7n6nfer6u57v9cac84t7nl2zth0xpyfeg0w2p2wv2yn6jn923aaz0vdaml07l60ahapk6efchyxwysrvjs87qvlj";
|
||||
let encoded_test = "secret-extended-key-test1qqqqqqqqqqqqqq8n3zjjmvhhr854uy3qhpda3ml34haf0x388z5r7h4st4kpsf6qysqws3xh6qmha7gna72fs2n4clnc9zgyd22s658f65pex4exe56qjk5pqj9vfdq7dfdhjc2rs9jdwq0zl99uwycyrxzp86705rk687spn44e2uhm7h0hsagfvkk4n7n6nfer6u57v9cac84t7nl2zth0xpyfeg0w2p2wv2yn6jn923aaz0vdaml07l60ahapk6efchyxwysrvjsvzyw8j";
|
||||
|
||||
assert_eq!(
|
||||
encode_extended_spending_key(
|
||||
constants::mainnet::HRP_SAPLING_EXTENDED_SPENDING_KEY,
|
||||
&extsk
|
||||
),
|
||||
encoded_main
|
||||
);
|
||||
assert_eq!(
|
||||
decode_extended_spending_key(
|
||||
constants::mainnet::HRP_SAPLING_EXTENDED_SPENDING_KEY,
|
||||
encoded_main
|
||||
)
|
||||
.unwrap(),
|
||||
Some(extsk.clone())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
encode_extended_spending_key(
|
||||
constants::testnet::HRP_SAPLING_EXTENDED_SPENDING_KEY,
|
||||
&extsk
|
||||
),
|
||||
encoded_test
|
||||
);
|
||||
assert_eq!(
|
||||
decode_extended_spending_key(
|
||||
constants::testnet::HRP_SAPLING_EXTENDED_SPENDING_KEY,
|
||||
encoded_test
|
||||
)
|
||||
.unwrap(),
|
||||
Some(extsk)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extended_full_viewing_key() {
|
||||
let extfvk = (&ExtendedSpendingKey::master(&[0; 32][..])).into();
|
||||
|
||||
let encoded_main = "zxviews1qqqqqqqqqqqqqq8n3zjjmvhhr854uy3qhpda3ml34haf0x388z5r7h4st4kpsf6qy3zw4wc246aw9rlfyg5ndlwvne7mwdq0qe6vxl42pqmcf8pvmmd5slmjxduqa9evgej6wa3th2505xq4nggrxdm93rxk4rpdjt5nmq2vn44e2uhm7h0hsagfvkk4n7n6nfer6u57v9cac84t7nl2zth0xpyfeg0w2p2wv2yn6jn923aaz0vdaml07l60ahapk6efchyxwysrvjsxmansf";
|
||||
let encoded_test = "zxviewtestsapling1qqqqqqqqqqqqqq8n3zjjmvhhr854uy3qhpda3ml34haf0x388z5r7h4st4kpsf6qy3zw4wc246aw9rlfyg5ndlwvne7mwdq0qe6vxl42pqmcf8pvmmd5slmjxduqa9evgej6wa3th2505xq4nggrxdm93rxk4rpdjt5nmq2vn44e2uhm7h0hsagfvkk4n7n6nfer6u57v9cac84t7nl2zth0xpyfeg0w2p2wv2yn6jn923aaz0vdaml07l60ahapk6efchyxwysrvjs8evfkz";
|
||||
|
||||
assert_eq!(
|
||||
encode_extended_full_viewing_key(
|
||||
constants::mainnet::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
|
||||
&extfvk
|
||||
),
|
||||
encoded_main
|
||||
);
|
||||
assert_eq!(
|
||||
decode_extended_full_viewing_key(
|
||||
constants::mainnet::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
|
||||
encoded_main
|
||||
)
|
||||
.unwrap(),
|
||||
Some(extfvk.clone())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
encode_extended_full_viewing_key(
|
||||
constants::testnet::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
|
||||
&extfvk
|
||||
),
|
||||
encoded_test
|
||||
);
|
||||
assert_eq!(
|
||||
decode_extended_full_viewing_key(
|
||||
constants::testnet::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
|
||||
encoded_test
|
||||
)
|
||||
.unwrap(),
|
||||
Some(extfvk)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn payment_address() {
|
||||
let rng = &mut XorShiftRng::from_seed([
|
||||
|
Loading…
Reference in New Issue
Block a user