Browse Source

get_new_address -> get_address

283
thomasv 12 years ago
parent
commit
799c2e8984
  1. 17
      lib/account.py
  2. 4
      lib/wallet.py

17
lib/account.py

@ -35,12 +35,12 @@ class Account(object):
def create_new_address(self, for_change):
addresses = self.change if for_change else self.addresses
n = len(addresses)
address = self.get_new_address( for_change, n)
address = self.get_address( for_change, n)
addresses.append(address)
print address
return address
def get_new_address(self, for_change, n):
def get_address(self, for_change, n):
pass
@ -156,7 +156,7 @@ class BIP32_Account(Account):
d['cK'] = self.cK.encode('hex')
return d
def get_new_address(self, for_change, n):
def get_address(self, for_change, n):
pubkey = self.get_pubkey(for_change, n)
address = public_key_to_bc_address( pubkey )
return address
@ -168,12 +168,6 @@ class BIP32_Account(Account):
K, K_compressed, chain = CKD_prime(K, chain, i)
return K_compressed
def get_address(self, sequence):
for_change, n = sequence
pubkey = self.get_pubkey(for_change, n)
address = public_key_to_bc_address( pubkey )
return address
def get_private_key(self, sequence, master_k):
chain = self.c
k = master_k
@ -189,7 +183,8 @@ class BIP32_Account(Account):
assert self.mpk == (master_public_key.encode('hex'), master_chain.encode('hex'))
def get_input_info(self, sequence):
pk_addr = self.get_address(sequence)
chain, i = sequence
pk_addr = self.get_address(chain, i)
redeemScript = None
return pk_addr, redeemScript
@ -217,7 +212,7 @@ class BIP32_Account_2of2(BIP32_Account):
K, K_compressed, chain = CKD_prime(K, chain, i)
return K_compressed
def get_new_address(self, for_change, n):
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"]

4
lib/wallet.py

@ -313,10 +313,10 @@ class Wallet:
pk = self.accounts["m/0'/0'"].get_private_key(sequence, master_k)
out[address] = pk
elif account == "m/1'/1 & m/2'/1":
elif account == "m/1'/0 & m/2'/0":
master_k = self.master_private_keys["m/1'/"]
master_c, master_K, _ = self.master_public_keys["m/1'/"]
master_k, master_c = CKD(master_k.decode('hex'), master_c.decode('hex'), 1)
master_k, master_c = CKD(master_k.decode('hex'), master_c.decode('hex'), 0)
pk = self.accounts[account].get_private_key(sequence, master_k)
out[address] = pk

Loading…
Cancel
Save