electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit ef74ae57ff488c784e3890429ea8e8335b5b8569
parent 03f4b4c9330e2c973b336bde1ca93534d8d9cc8c
Author: ThomasV <thomasv@gitorious>
Date:   Mon, 25 Aug 2014 15:32:21 +0200

fix tests

Diffstat:
Mlib/bitcoin.py | 3+--
Mlib/tests/test_bitcoin.py | 2+-
Mlib/wallet.py | 4++--
3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/bitcoin.py b/lib/bitcoin.py @@ -706,10 +706,9 @@ def xpub_from_xprv(xprv, testnet=False): return EncodeBase58Check(xpub) -def bip32_root(mnemonic_seed, testnet=False): +def bip32_root(seed, testnet=False): import hmac header_pub, header_priv = _get_headers(testnet) - seed = mnemonic_to_seed(mnemonic_seed,'') I = hmac.new("Bitcoin seed", seed, hashlib.sha512).digest() master_k = I[0:32] master_c = I[32:] diff --git a/lib/tests/test_bitcoin.py b/lib/tests/test_bitcoin.py @@ -68,7 +68,7 @@ class Test_bitcoin(unittest.TestCase): assert xprv == "tprv8jTo9vZtZTSiTo6BBDjeQDgLEaipWPsrhYsQpZYoqqJNPKbCyDewkHJZhkoSHiWYCUf1Gm4TFzQxcG4D6s1J9Hsn4whDK7QYyHHokJeUuac" def _do_test_bip32(self, seed, sequence, testnet): - xprv, xpub = bip32_root(seed, testnet) + xprv, xpub = bip32_root(seed.decode('hex'), testnet) assert sequence[0:2] == "m/" path = 'm' sequence = sequence[2:] diff --git a/lib/wallet.py b/lib/wallet.py @@ -1385,7 +1385,7 @@ class BIP39_Wallet(BIP32_Wallet): def create_master_keys(self, password): seed = self.get_seed(password) - xprv, xpub = bip32_root(seed) + xprv, xpub = bip32_root(mnemonic_to_seed(seed,'')) xprv, xpub = bip32_private_derivation(xprv, "m/", self.root_derivation) self.add_master_public_key(self.root_name, xpub) self.add_master_private_key(self.root_name, xprv, password) @@ -1459,7 +1459,7 @@ class Wallet_2of2(BIP39_Wallet): def add_cosigner_seed(self, seed, name, password): # we don't store the seed, only the master xpriv - xprv, xpub = bip32_root(seed) + xprv, xpub = bip32_root(mnemonic_to_seed(seed,'')) xprv, xpub = bip32_private_derivation(xprv, "m/", self.root_derivation) self.add_master_public_key(name, xpub) self.add_master_private_key(name, xprv, password)