diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index ac3c6ac9776534fd5eed999d590eb3678c4914ea..5786b85e65b2834cf24a37540948445fa88d8530 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -196,6 +196,18 @@ class Account(QObject): def set_display_referential(self, index): self._current_ref = index + def set_scrypt_infos(self, salt, password): + """ + Change the size of the wallet pool + :param int size: The new size of the wallet pool + :param str password: The password of the account, same for all wallets + """ + self.salt = salt + self.pubkey = SigningKey(self.salt, password).pubkey + wallet = Wallet.create(0, self.salt, password, + "Wallet", self._identities_registry) + self.wallets.append(wallet) + def identity(self, community): """ Get the account identity in the specified community @@ -212,23 +224,6 @@ class Account(QObject): def current_ref(self): return money.Referentials[self._current_ref] - def set_walletpool_size(self, size, password): - """ - Change the size of the wallet pool - - :param int size: The new size of the wallet pool - :param str password: The password of the account, same for all wallets - """ - logging.debug("Defining wallet pool size") - if len(self.wallets) < size: - for i in range(len(self.wallets), size): - wallet = Wallet.create(i, self.salt, password, - "Wallet {0}".format(i), self._identities_registry) - self.wallets.append(wallet) - else: - self.wallets = self.wallets[:size] - self.wallets_changed.emit() - def transfers(self, community): """ Get all transfers done in a community by all the wallets diff --git a/src/cutecoin/core/wallet.py b/src/cutecoin/core/wallet.py index f7ea800bfd29ea624281bb3350439dd43e9bc25c..0b3a2c8b0d8737ec2459f8ce11247b33a32e2c15 100644 --- a/src/cutecoin/core/wallet.py +++ b/src/cutecoin/core/wallet.py @@ -60,7 +60,7 @@ class Wallet(QObject): if walletid == 0: key = SigningKey(salt, password) else: - key = SigningKey("{0}{1}".format(salt, walletid), password) + key = SigningKey(b"{0}{1}".format(salt, walletid), password) return cls(walletid, key.pubkey, name, identities_registry) @classmethod diff --git a/src/cutecoin/gui/process_cfg_account.py b/src/cutecoin/gui/process_cfg_account.py index 9a5a6ec3999af701f4ea674da9b3ddaa41097e9d..d9a63e4d12576d3b75047666d94285141ad47b2a 100644 --- a/src/cutecoin/gui/process_cfg_account.py +++ b/src/cutecoin/gui/process_cfg_account.py @@ -94,8 +94,7 @@ class StepPageKey(Step): def process_next(self): salt = self.config_dialog.edit_salt.text() password = self.config_dialog.edit_password.text() - self.config_dialog.account.salt = salt - self.config_dialog.account.pubkey = SigningKey(salt, password).pubkey + self.config_dialog.account.set_scrypt_infos(salt, password) self.config_dialog.password_asker = PasswordAskerDialog(self.config_dialog.account) model = CommunitiesListModel(self.config_dialog.account) self.config_dialog.list_communities.setModel(model) diff --git a/src/cutecoin/tests/certification/test_certification.py b/src/cutecoin/tests/certification/test_certification.py index 33c81b87ac9292da4504cdc63390317f49d82ca3..71c634b046050d18fdf4a71ca4bd7e91843aaa43 100644 --- a/src/cutecoin/tests/certification/test_certification.py +++ b/src/cutecoin/tests/certification/test_certification.py @@ -90,6 +90,7 @@ class TestCertificationDialog(unittest.TestCase): self.lp.call_later(15, close_dialog) asyncio.async(exec_test()) self.lp.run_until_complete(open_dialog(certification_dialog)) + mock.delete_mock() if __name__ == '__main__': diff --git a/src/cutecoin/tests/identities_tab/test_identities_table.py b/src/cutecoin/tests/identities_tab/test_identities_table.py index 9bafb74ada7577736d46ed9506d17565b49c578b..fc1c093b06ef90024cab63842bd002340a07a8d4 100644 --- a/src/cutecoin/tests/identities_tab/test_identities_table.py +++ b/src/cutecoin/tests/identities_tab/test_identities_table.py @@ -105,6 +105,7 @@ class TestIdentitiesTable(unittest.TestCase): asyncio.async(exec_test()) self.lp.run_until_complete(async_open_widget()) + mock.delete_mock() if __name__ == '__main__': logging.basicConfig( stream=sys.stderr ) diff --git a/src/cutecoin/tests/process_cfg_account/test_add_account.py b/src/cutecoin/tests/process_cfg_account/test_add_account.py index cc8f6593f54948687c20a236ffbcbc71ead81827..cd6808c164b50e1668a6b507bc436946e1199220 100644 --- a/src/cutecoin/tests/process_cfg_account/test_add_account.py +++ b/src/cutecoin/tests/process_cfg_account/test_add_account.py @@ -94,6 +94,7 @@ class ProcessAddCommunity(unittest.TestCase): self.assertEqual(len(self.application.accounts), 1) self.assertEqual(self.application.current_account.name, "test") self.assertEqual(self.application.preferences['account'], "test") + self.assertEqual(len(self.application.current_account.wallets), 1) self.lp.call_later(10, close_dialog) asyncio.async(exec_test())