tlightning: save key derivation point - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 311c53ef1d470e2dae7011a9de480e4c5e4ae524 DIR parent 6ab8badb615db8d30d3631f1d3fbc6562bf6b7c7 HTML Author: Janus <ysangkok@gmail.com> Date: Tue, 20 Mar 2018 13:08:55 +0100 lightning: save key derivation point Diffstat: M lib/lightning.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- DIR diff --git a/lib/lightning.py b/lib/lightning.py t@@ -688,6 +688,7 @@ class LightningWorker: async def run(self, netAndWalLock): global WALLET, NETWORK global CONFIG + global globalIdx wasAlreadyUpToDate = False t@@ -696,6 +697,9 @@ class LightningWorker: NETWORK = self.network() CONFIG = self.config() + globalIdx = WALLET.storage.get("lightning_global_key_index", 0) + if globalIdx != 0: print("initial lightning global key index", globalIdx) + writer = None print("OPENING CONNECTION") try: t@@ -846,7 +850,7 @@ def DerivePrivKey(json): msg = json_format.MessageToJson(m) return msg -globalIdx = 0 +globalIdx = None def DeriveNextKey(json): global globalIdx t@@ -864,6 +868,8 @@ def DeriveNextKey(json): m.keyDescriptor.pubKey = pubkFromECKEY(fetchPrivKey(None, 9000, globalIdx)) globalIdx += 1 + WALLET.storage.put("lightning_global_key_index", globalIdx) + WALLET.storage.write() msg = json_format.MessageToJson(m) return msg