From 997315c4340fb5c5cf7ba7df858bb51ed7b6acc7 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:30:16 +0200 Subject: [PATCH] Deserialize DLEQ from string --- cashu/core/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cashu/core/base.py b/cashu/core/base.py index 2d3f05d0..6b8e03d0 100644 --- a/cashu/core/base.py +++ b/cashu/core/base.py @@ -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