labels plugin: use get_fingerprint

This commit is contained in:
ThomasV 2016-02-22 15:44:31 +01:00
parent 9b99693ca1
commit f97fdf3ba8
2 changed files with 10 additions and 1 deletions

View File

@ -1411,6 +1411,8 @@ class Abstract_Wallet(PrintError):
return -1, (0, 0)
return sorted(map(lambda x: self.get_payment_request(x, config), self.receive_requests.keys()), key=f)
def get_fingerprint(self):
raise NotImplementedError()
class Imported_Wallet(Abstract_Wallet):
@ -1445,6 +1447,8 @@ class Imported_Wallet(Abstract_Wallet):
def is_beyond_limit(self, address, account, is_change):
return False
def get_fingerprint(self):
return ''
class Deterministic_Wallet(Abstract_Wallet):
@ -1574,6 +1578,8 @@ class Deterministic_Wallet(Abstract_Wallet):
out[name] = mpk_text
return out
def get_fingerprint(self):
return self.get_master_public_key()
class BIP32_Wallet(Deterministic_Wallet):
@ -1850,6 +1856,9 @@ class Multisig_Wallet(BIP32_RD_Wallet, Mnemonic):
if not self.accounts:
return 'create_main_account'
def get_fingerprint(self):
return ''.join(sorted(self.get_master_public_keys().values()))
class OldWallet(Deterministic_Wallet):
wallet_type = 'old'

View File

@ -136,7 +136,7 @@ class LabelsPlugin(BasePlugin):
def start_wallet(self, wallet):
nonce = self.get_nonce(wallet)
self.print_error("wallet", wallet.basename(), "nonce is", nonce)
mpk = ''.join(sorted(wallet.get_master_public_keys().values()))
mpk = wallet.get_fingerprint()
if not mpk:
return
password = hashlib.sha1(mpk).digest().encode('hex')[:32]