1
0

storage upgrade: convert lists to dict (txi, txo, revocation_store channels)

This commit is contained in:
ThomasV
2020-02-04 12:11:18 +01:00
parent 63963323be
commit b08947a506
3 changed files with 56 additions and 24 deletions

View File

@@ -355,7 +355,7 @@ class LNWallet(LNWorker):
# note: accessing channels (besides simple lookup) needs self.lock!
self.channels = {} # type: Dict[bytes, Channel]
for x in wallet.storage.get("channels", []):
for x in wallet.storage.get("channels", {}).values():
c = Channel(x, sweep_address=self.sweep_address, lnworker=self)
self.channels[c.channel_id] = c
# timestamps of opening and closing transactions
@@ -617,7 +617,7 @@ class LNWallet(LNWorker):
def save_channels(self):
with self.lock:
dumped = [x.serialize() for x in self.channels.values()]
dumped = dict( (k.hex(), c.serialize()) for k, c in self.channels.items() )
self.storage.put("channels", dumped)
self.storage.write()