1
0

wallet_db: encapsulate type conversions with attr.s converter

This commit is contained in:
ThomasV
2020-03-17 11:04:49 +01:00
parent df15042cee
commit 444610452e
2 changed files with 17 additions and 24 deletions

View File

@@ -1101,18 +1101,6 @@ class WalletDB(JsonDB):
v = ChannelConstraints(**v)
elif key == 'funding_outpoint':
v = Outpoint(**v)
elif key.endswith("_basepoint") or key.endswith("_key"):
v = Keypair(**v) if len(v)==2 else OnlyPubkeyKeypair(**v)
elif key in [
"short_channel_id",
"current_per_commitment_point",
"next_per_commitment_point",
"per_commitment_secret_seed",
"current_commitment_signature",
"current_htlc_signatures"]:
v = binascii.unhexlify(v) if v is not None else None
elif len(path) > 2 and path[-2] in ['local_config', 'remote_config'] and key in ["pubkey", "privkey"]:
v = binascii.unhexlify(v) if v is not None else None
return v
def write(self, storage: 'WalletStorage'):