From 93327e8c734c948ff7d5f494005f01accf31955c Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Mon, 31 Oct 2016 14:07:55 +0100 Subject: [PATCH] Fix the brainwallet functionality. (#2994) (#3005) --- ethkey/src/brain.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ethkey/src/brain.rs b/ethkey/src/brain.rs index f7f9322e0..dd8913c66 100644 --- a/ethkey/src/brain.rs +++ b/ethkey/src/brain.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use keccak::Keccak256; -use super::{KeyPair, Error, Generator, Secret}; +use super::{KeyPair, Error, Generator}; /// Simple brainwallet. pub struct Brain(String); @@ -38,9 +38,9 @@ impl Generator for Brain { match i > 16384 { false => i += 1, true => { - let result = KeyPair::from_secret(Secret::from(secret.clone())); - if result.is_ok() { - return result + let result = KeyPair::from_secret(secret.clone().into()); + if result.as_ref().ok().map_or(false, |r| r.address()[0] == 0) { + return result; } }, }