fix(dubp): dewif: wallet type generation inverted

This commit is contained in:
librelois 2021-02-12 18:55:03 +01:00
parent 3b876cf383
commit 2c9732638f
2 changed files with 5 additions and 5 deletions

View File

@ -57,7 +57,7 @@ pub(super) fn gen_dewif(
let secret_code = gen_secret_code(member_wallet, secret_code_type, log_n)?;
let (dewif, pubkey) = match wallet_type {
WalletType::Ed25519 => {
WalletType::Bip32Ed25519 => {
let keypair = dup_crypto::keys::ed25519::bip32::KeyPair::from_seed(seed.clone());
let pubkey = keypair.public_key();
let dewif = dup_crypto::dewif::write_dewif_v4_content(
@ -69,7 +69,7 @@ pub(super) fn gen_dewif(
);
(dewif, pubkey.to_base58())
}
WalletType::Bip32Ed25519 => {
WalletType::Ed25519 => {
let keypair = KeyPairFromSeed32Generator::generate(seed);
let dewif =
dup_crypto::dewif::write_dewif_v3_content(currency, &keypair, log_n, &secret_code);

View File

@ -56,7 +56,7 @@ pub(crate) fn char_ptr_prt_to_vec_hard_derivation_index(
u32_ptr: *const u32,
len: u32,
) -> Result<Vec<DerivationIndex>, DubpError> {
u32_ptr_to_vec_u32(u32_ptr, len)?
u32_ptr_to_vec_u32(u32_ptr, len)
.into_iter()
.map(|ai| DerivationIndex::hard(ai).map_err(DubpError::InvalidDerivationIndex))
.collect()
@ -93,14 +93,14 @@ pub(crate) fn transparent_account_index(account_index: u32) -> Result<Derivation
}
}
pub(crate) fn u32_ptr_to_vec_u32(u32_ptr: *const u32, len: u32) -> Result<Vec<u32>, DubpError> {
pub(crate) fn u32_ptr_to_vec_u32(u32_ptr: *const u32, len: u32) -> Vec<u32> {
let len = len as usize;
let u32_slice: &[u32] = unsafe { std::slice::from_raw_parts(u32_ptr, len) };
let mut vec = Vec::with_capacity(len);
for u32_ in u32_slice {
vec.push(*u32_);
}
Ok(vec)
vec
}
pub(crate) fn u32_to_language(i: u32) -> Result<Language, DubpError> {