Skip to content

Commit

Permalink
Deserialize DLEQ from string
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Jul 10, 2024
1 parent d4922a0 commit 997315c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cashu/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ def __init__(self, **data):
def from_dict(cls, proof_dict: dict):
if proof_dict.get("dleq") and isinstance(proof_dict["dleq"], dict):
proof_dict["dleq"] = DLEQWallet(**proof_dict["dleq"])
elif proof_dict.get("dleq") and isinstance(proof_dict["dleq"], str):
# Proofs read from the database have the DLEQ proof as a string
proof_dict["dleq"] = DLEQWallet(**json.loads(proof_dict["dleq"]))
else:
# overwrite the empty string with None
proof_dict["dleq"] = None
Expand Down

0 comments on commit 997315c

Please sign in to comment.