forked from LBRYCommunity/lbry-sdk
fixes
This commit is contained in:
parent
270f77df24
commit
45eef03576
3 changed files with 9 additions and 1 deletions
|
@ -1656,6 +1656,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
for new_account in added_accounts:
|
for new_account in added_accounts:
|
||||||
asyncio.create_task(self.ledger.subscribe_account(new_account))
|
asyncio.create_task(self.ledger.subscribe_account(new_account))
|
||||||
wallet.save()
|
wallet.save()
|
||||||
|
wallet.unlock(password)
|
||||||
encrypted = wallet.pack(encrypt_password or password)
|
encrypted = wallet.pack(encrypt_password or password)
|
||||||
return {
|
return {
|
||||||
'hash': self.jsonrpc_sync_hash(wallet_id),
|
'hash': self.jsonrpc_sync_hash(wallet_id),
|
||||||
|
|
|
@ -34,6 +34,12 @@ class WalletSynchronization(CommandTestCase):
|
||||||
|
|
||||||
self.assertEqual(len((await daemon.jsonrpc_account_list())['lbc_regtest']), 1)
|
self.assertEqual(len((await daemon.jsonrpc_account_list())['lbc_regtest']), 1)
|
||||||
|
|
||||||
|
daemon2.jsonrpc_wallet_encrypt('password')
|
||||||
|
daemon2.jsonrpc_wallet_lock()
|
||||||
|
with self.assertRaises(AssertionError):
|
||||||
|
await daemon2.jsonrpc_sync_apply('password')
|
||||||
|
|
||||||
|
daemon2.jsonrpc_wallet_unlock('password')
|
||||||
data = await daemon2.jsonrpc_sync_apply('password')
|
data = await daemon2.jsonrpc_sync_apply('password')
|
||||||
await daemon.jsonrpc_sync_apply('password', data=data['data'], blocking=True)
|
await daemon.jsonrpc_sync_apply('password', data=data['data'], blocking=True)
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,7 @@ class Wallet:
|
||||||
def lock(self):
|
def lock(self):
|
||||||
for account in self.accounts:
|
for account in self.accounts:
|
||||||
if not account.encrypted:
|
if not account.encrypted:
|
||||||
|
assert account.password is not None, "account was never encrypted"
|
||||||
account.encrypt(account.password)
|
account.encrypt(account.password)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -201,7 +202,7 @@ class Wallet:
|
||||||
|
|
||||||
def encrypt(self, password):
|
def encrypt(self, password):
|
||||||
for account in self.accounts:
|
for account in self.accounts:
|
||||||
if not self.encrypted:
|
if not account.encrypted:
|
||||||
account.encrypt(password)
|
account.encrypt(password)
|
||||||
account.serialize_encrypted = True
|
account.serialize_encrypted = True
|
||||||
self.save()
|
self.save()
|
||||||
|
|
Loading…
Add table
Reference in a new issue