mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 02:05:19 +00:00
lightning: save key derivation point
This commit is contained in:
parent
2046859bf3
commit
c90bbf8d27
1 changed files with 7 additions and 1 deletions
|
@ -688,6 +688,7 @@ class LightningWorker:
|
||||||
async def run(self, netAndWalLock):
|
async def run(self, netAndWalLock):
|
||||||
global WALLET, NETWORK
|
global WALLET, NETWORK
|
||||||
global CONFIG
|
global CONFIG
|
||||||
|
global globalIdx
|
||||||
|
|
||||||
wasAlreadyUpToDate = False
|
wasAlreadyUpToDate = False
|
||||||
|
|
||||||
|
@ -696,6 +697,9 @@ class LightningWorker:
|
||||||
NETWORK = self.network()
|
NETWORK = self.network()
|
||||||
CONFIG = self.config()
|
CONFIG = self.config()
|
||||||
|
|
||||||
|
globalIdx = WALLET.storage.get("lightning_global_key_index", 0)
|
||||||
|
if globalIdx != 0: print("initial lightning global key index", globalIdx)
|
||||||
|
|
||||||
writer = None
|
writer = None
|
||||||
print("OPENING CONNECTION")
|
print("OPENING CONNECTION")
|
||||||
try:
|
try:
|
||||||
|
@ -846,7 +850,7 @@ def DerivePrivKey(json):
|
||||||
msg = json_format.MessageToJson(m)
|
msg = json_format.MessageToJson(m)
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
globalIdx = 0
|
globalIdx = None
|
||||||
|
|
||||||
def DeriveNextKey(json):
|
def DeriveNextKey(json):
|
||||||
global globalIdx
|
global globalIdx
|
||||||
|
@ -864,6 +868,8 @@ def DeriveNextKey(json):
|
||||||
|
|
||||||
m.keyDescriptor.pubKey = pubkFromECKEY(fetchPrivKey(None, 9000, globalIdx))
|
m.keyDescriptor.pubKey = pubkFromECKEY(fetchPrivKey(None, 9000, globalIdx))
|
||||||
globalIdx += 1
|
globalIdx += 1
|
||||||
|
WALLET.storage.put("lightning_global_key_index", globalIdx)
|
||||||
|
WALLET.storage.write()
|
||||||
|
|
||||||
msg = json_format.MessageToJson(m)
|
msg = json_format.MessageToJson(m)
|
||||||
return msg
|
return msg
|
||||||
|
|
Loading…
Add table
Reference in a new issue