mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
follow-up prev: avoid storage key collision with old 'lightning_privkey'
This commit is contained in:
parent
3b938160d1
commit
8967b5848e
1 changed files with 2 additions and 2 deletions
|
@ -62,13 +62,13 @@ class LNWorker(PrintError):
|
||||||
asyncio.run_coroutine_threadsafe(self.network.main_taskgroup.spawn(self.main_loop()), self.network.asyncio_loop)
|
asyncio.run_coroutine_threadsafe(self.network.main_taskgroup.spawn(self.main_loop()), self.network.asyncio_loop)
|
||||||
|
|
||||||
def _read_ln_keystore(self) -> BIP32_KeyStore:
|
def _read_ln_keystore(self) -> BIP32_KeyStore:
|
||||||
xprv = self.wallet.storage.get('lightning_privkey')
|
xprv = self.wallet.storage.get('lightning_privkey2')
|
||||||
if xprv is None:
|
if xprv is None:
|
||||||
# TODO derive this deterministically from wallet.keystore at keystore generation time
|
# TODO derive this deterministically from wallet.keystore at keystore generation time
|
||||||
# probably along a hardened path ( lnd-equivalent would be m/1017'/coinType'/ )
|
# probably along a hardened path ( lnd-equivalent would be m/1017'/coinType'/ )
|
||||||
seed = os.urandom(32)
|
seed = os.urandom(32)
|
||||||
xprv, xpub = bitcoin.bip32_root(seed, xtype='standard')
|
xprv, xpub = bitcoin.bip32_root(seed, xtype='standard')
|
||||||
self.wallet.storage.put('lightning_privkey', xprv)
|
self.wallet.storage.put('lightning_privkey2', xprv)
|
||||||
self.wallet.storage.write()
|
self.wallet.storage.write()
|
||||||
return keystore.from_xprv(xprv)
|
return keystore.from_xprv(xprv)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue