diff --git a/cashu/core/base.py b/cashu/core/base.py index c8d6a83..76492cf 100644 --- a/cashu/core/base.py +++ b/cashu/core/base.py @@ -103,18 +103,18 @@ class Proof(BaseModel): 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) + # necessary fields + return_dict = 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(), - ) + # 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 663d212..5956271 100644 --- a/cashu/wallet/__init__.py +++ b/cashu/wallet/__init__.py @@ -4,8 +4,6 @@ from loguru import logger 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")