tlnworker: generate and save private key - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit b74d4261af686c997d6229dd2befbe72dc0e34af
DIR parent af4f0b6daf1590929183c1975a5a9823c71685a7
HTML Author: ThomasV <thomasv@electrum.org>
Date: Wed, 30 May 2018 13:52:01 +0200
lnworker: generate and save private key
Diffstat:
M lib/lnworker.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
DIR diff --git a/lib/lnworker.py b/lib/lnworker.py
t@@ -91,7 +91,12 @@ class LNWorker(PrintError):
def __init__(self, wallet, network):
self.wallet = wallet
self.network = network
- self.privkey = sha256(b"0123456789")
+ pk = wallet.storage.get('lightning_privkey')
+ if pk is None:
+ pk = bh2u(os.urandom(32))
+ wallet.storage.put('lightning_privkey', pk)
+ wallet.storage.write()
+ self.privkey = bfh(pk)
self.config = network.config
self.peers = {}
# view of the network