diff --git a/cashu/core/base.py b/cashu/core/base.py index c8d6a837..76492cf7 100644 --- a/cashu/core/base.py +++ b/cashu/core/base.py @@ -103,18 +103,18 @@ def from_dict(cls, proof_dict: dict): return c def to_dict(self, include_dleq=False): - # dictionary without the fields that don't need to be send to Carol - if not include_dleq: - return dict(id=self.id, amount=self.amount, secret=self.secret, C=self.C) - - assert self.dleq, "DLEQ proof is missing" - return dict( - id=self.id, - amount=self.amount, - secret=self.secret, - C=self.C, - dleq=self.dleq.dict(), - ) + # necessary fields + return_dict = dict(id=self.id, amount=self.amount, secret=self.secret, C=self.C) + + # optional fields + if include_dleq: + assert self.dleq, "DLEQ proof is missing" + return_dict["dleq"] = self.dleq.dict() # type: ignore + + if self.witness: + return_dict["witness"] = self.witness + + return return_dict def to_dict_no_dleq(self): # dictionary without the fields that don't need to be send to Carol diff --git a/cashu/wallet/__init__.py b/cashu/wallet/__init__.py index 663d2122..59562710 100644 --- a/cashu/wallet/__init__.py +++ b/cashu/wallet/__init__.py @@ -4,8 +4,6 @@ from ..core.settings import settings -sys.tracebacklimit = None # type: ignore - # configure logger logger.remove() logger.add(sys.stderr, level="DEBUG" if settings.debug else "INFO")