electrum

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

commit 1ff2f1b30801f0f90b45b08b98c480b119c9196d
parent b08f1a2a7b7eb11fbd6297f54fb3e5fcd5d55dc7
Author: ThomasV <thomasv@gitorious>
Date:   Wed,  7 Aug 2013 20:04:43 +0200

hex encode the output of account.get_pubkey()

Diffstat:
Mlib/account.py | 10+++++-----
Mlib/wallet.py | 2+-
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/account.py b/lib/account.py @@ -161,7 +161,7 @@ class BIP32_Account(Account): def get_address(self, for_change, n): pubkey = self.get_pubkey(for_change, n) - address = public_key_to_bc_address( pubkey ) + address = public_key_to_bc_address( pubkey.decode('hex') ) return address def get_pubkey(self, for_change, n): @@ -169,7 +169,7 @@ class BIP32_Account(Account): chain = self.c for i in [for_change, n]: K, K_compressed, chain = CKD_prime(K, chain, i) - return K_compressed + return K_compressed.encode('hex') def get_private_key(self, sequence, master_k): chain = self.c @@ -213,12 +213,12 @@ class BIP32_Account_2of2(BIP32_Account): chain = self.c2 for i in [for_change, n]: K, K_compressed, chain = CKD_prime(K, chain, i) - return K_compressed + return K_compressed.encode('hex') def get_address(self, for_change, n): pubkey1 = self.get_pubkey(for_change, n) pubkey2 = self.get_pubkey2(for_change, n) - address = Transaction.multisig_script([pubkey1.encode('hex'), pubkey2.encode('hex')], 2)["address"] + address = Transaction.multisig_script([pubkey1, pubkey2], 2)["address"] return address def get_input_info(self, sequence): @@ -227,6 +227,6 @@ class BIP32_Account_2of2(BIP32_Account): pubkey2 = self.get_pubkey2(chain, i) # fixme pk_addr = None # public_key_to_bc_address( pubkey1 ) # we need to return that address to get the right private key - redeemScript = Transaction.multisig_script([pubkey1.encode('hex'), pubkey2.encode('hex')], 2)['redeemScript'] + redeemScript = Transaction.multisig_script([pubkey1, pubkey2], 2)['redeemScript'] return pk_addr, redeemScript diff --git a/lib/wallet.py b/lib/wallet.py @@ -294,7 +294,7 @@ class Wallet: def get_public_key(self, address): account, sequence = self.get_address_index(address) - return self.accounts[account].get_pubkey( sequence ) + return self.accounts[account].get_pubkey( *sequence ) def decode_seed(self, password):