Skip to content

Commit

Permalink
Merge pull request #162 from input-output-hk/wallet-recovery-cleanup
Browse files Browse the repository at this point in the history
Small fixes in wallet bindings API and code
  • Loading branch information
ecioppettini committed Jul 29, 2021
2 parents 7482052 + 6e7695e commit 4a67c50
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
15 changes: 0 additions & 15 deletions bindings/wallet-c/src/lib.rs
@@ -1,5 +1,4 @@
pub mod settings;
pub use chain_impl_mockchain::vote::PayloadType as PayloadTypeRust;
use std::{
ffi::{CStr, CString},
os::raw::c_char,
Expand Down Expand Up @@ -42,20 +41,6 @@ pub type FragmentPtr = *mut Fragment;
pub type ErrorPtr = *mut Error;
pub type EncryptingVoteKeyPtr = *mut EncryptingVoteKey;

/// Payload type for voting
#[repr(u8)]
pub enum PayloadType {
Public = 1,
}

impl From<PayloadType> for PayloadTypeRust {
fn from(c_enum: PayloadType) -> Self {
match c_enum {
PayloadType::Public => PayloadTypeRust::Public,
}
}
}

/// retrieve a wallet from the given mnemonics, password and protocol magic
///
/// this function will work for all yoroi, daedalus and other wallets
Expand Down
5 changes: 0 additions & 5 deletions bindings/wallet-js/src/lib.rs
Expand Up @@ -38,11 +38,6 @@ pub struct VotePlanId([u8; wallet_core::VOTE_PLAN_ID_LENGTH]);
#[wasm_bindgen]
pub struct Options(wallet_core::Options);

#[wasm_bindgen]
pub enum PayloadType {
Public,
}

impl_secret_key!(
Ed25519ExtendedPrivate,
chain_crypto::Ed25519Extended,
Expand Down
2 changes: 1 addition & 1 deletion wallet/src/scheme/freeutxo.rs
Expand Up @@ -77,7 +77,7 @@ impl Wallet {

fn check(&self, pk: &PublicKey<Ed25519>) -> Option<SecretKey<Ed25519Extended>> {
// FIXME: O(n)?
self.keys.iter().cloned().find(|k| &k.to_public() == pk)
self.keys.iter().find(|&k| &k.to_public() == pk).cloned()
}

pub fn check_fragment(&mut self, fragment_id: &FragmentId, fragment: &Fragment) -> bool {
Expand Down

0 comments on commit 4a67c50

Please sign in to comment.