forked from LBRYCommunity/lbry-sdk
wallet locking/unlocking no longer breaks deterministic channel keys
This commit is contained in:
parent
b5ead91746
commit
3a496902f8
2 changed files with 15 additions and 3 deletions
|
@ -39,9 +39,14 @@ class DeterministicChannelKeyManager:
|
|||
self.account = account
|
||||
self.last_known = 0
|
||||
self.cache = {}
|
||||
self.private_key: Optional[PrivateKey] = None
|
||||
if account.private_key is not None:
|
||||
self.private_key = account.private_key.child(KeyPath.CHANNEL)
|
||||
self._private_key: Optional[PrivateKey] = None
|
||||
|
||||
@property
|
||||
def private_key(self):
|
||||
if self._private_key is None:
|
||||
if self.account.private_key is not None:
|
||||
self._private_key = self.account.private_key.child(KeyPath.CHANNEL)
|
||||
return self._private_key
|
||||
|
||||
def maybe_generate_deterministic_key_for_channel(self, txo):
|
||||
if self.private_key is None:
|
||||
|
|
|
@ -365,6 +365,13 @@ class WalletEncryptionAndSynchronization(CommandTestCase):
|
|||
self.assertEqual(daemon2.jsonrpc_wallet_status(),
|
||||
{'is_locked': False, 'is_encrypted': True, 'is_syncing': False})
|
||||
|
||||
async def test_locking_unlocking_does_not_break_deterministic_channels(self):
|
||||
self.assertTrue(self.daemon.jsonrpc_wallet_encrypt("password"))
|
||||
self.assertTrue(self.daemon.jsonrpc_wallet_lock())
|
||||
self.account.deterministic_channel_keys._private_key = None
|
||||
self.assertTrue(self.daemon.jsonrpc_wallet_unlock("password"))
|
||||
await self.channel_create()
|
||||
|
||||
async def test_sync_with_encryption_and_password_change(self):
|
||||
daemon, daemon2 = self.daemon, self.daemon2
|
||||
wallet, wallet2 = daemon.wallet_manager.default_wallet, daemon2.wallet_manager.default_wallet
|
||||
|
|
Loading…
Reference in a new issue