proof.do_tict() minor fixup (#357)

This commit is contained in:
callebtc
2023-11-13 07:47:03 -03:00
committed by GitHub
parent 0c3777dd17
commit 3348ffa139
2 changed files with 11 additions and 13 deletions

View File

@@ -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

View File

@@ -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")