get_pubkey_from_x
authorThomasV <thomasv@gitorious>
Thu, 3 Apr 2014 14:11:28 +0000 (16:11 +0200)
committerThomasV <thomasv@gitorious>
Thu, 3 Apr 2014 14:11:28 +0000 (16:11 +0200)
lib/account.py

index 232cd9b..37ddc60 100644 (file)
@@ -140,27 +140,30 @@ class BIP32_Account(Account):
         return d
 
     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') )
         return address
 
     def first_address(self):
         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)
         for i in [for_change, n]:
             cK, c = CKD_pub(cK, c, i)
         return cK.encode('hex')
 
-    def redeem_script(self, sequence):
-        return None
-
     def get_pubkeys(self, sequence):
-        return sorted(map(lambda x: self.get_pubkey(x, *sequence ), self.get_master_pubkeys()))
+        return sorted(map(lambda x: self.get_pubkey_from_x(x, *sequence), self.get_master_pubkeys()))
 
-    def get_master_pubkeys(self):
-        return [self.xpub]
+    def get_pubkey(self, for_change, n):
+        return self.get_pubkeys((for_change, n))[0]
+
+    def redeem_script(self, sequence):
+        return None
 
     def get_type(self):
         return _('Standard 1 of 1')