get_pubkey_from_x
This commit is contained in:
@@ -140,28 +140,31 @@ class BIP32_Account(Account):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
def get_address(self, for_change, n):
|
def get_address(self, for_change, n):
|
||||||
pubkey = self.get_pubkey(self.xpub, for_change, n)
|
pubkey = self.get_pubkey(for_change, n)
|
||||||
address = public_key_to_bc_address( pubkey.decode('hex') )
|
address = public_key_to_bc_address( pubkey.decode('hex') )
|
||||||
return address
|
return address
|
||||||
|
|
||||||
def first_address(self):
|
def first_address(self):
|
||||||
return self.get_address(0,0)
|
return self.get_address(0,0)
|
||||||
|
|
||||||
def get_pubkey(self, xpub, for_change, n):
|
def get_master_pubkeys(self):
|
||||||
|
return [self.xpub]
|
||||||
|
|
||||||
|
def get_pubkey_from_x(self, xpub, for_change, n):
|
||||||
_, _, _, c, cK = deserialize_xkey(xpub)
|
_, _, _, c, cK = deserialize_xkey(xpub)
|
||||||
for i in [for_change, n]:
|
for i in [for_change, n]:
|
||||||
cK, c = CKD_pub(cK, c, i)
|
cK, c = CKD_pub(cK, c, i)
|
||||||
return cK.encode('hex')
|
return cK.encode('hex')
|
||||||
|
|
||||||
|
def get_pubkeys(self, sequence):
|
||||||
|
return sorted(map(lambda x: self.get_pubkey_from_x(x, *sequence), self.get_master_pubkeys()))
|
||||||
|
|
||||||
|
def get_pubkey(self, for_change, n):
|
||||||
|
return self.get_pubkeys((for_change, n))[0]
|
||||||
|
|
||||||
def redeem_script(self, sequence):
|
def redeem_script(self, sequence):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_pubkeys(self, sequence):
|
|
||||||
return sorted(map(lambda x: self.get_pubkey(x, *sequence ), self.get_master_pubkeys()))
|
|
||||||
|
|
||||||
def get_master_pubkeys(self):
|
|
||||||
return [self.xpub]
|
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
return _('Standard 1 of 1')
|
return _('Standard 1 of 1')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user