mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-23 19:54:18 +01:00
Fix blind message already signed error (#828)
* get unsigned blinded messages for output duplicate check * bm regression tests (#827) * fix last entry * test for error from error struct * rename tests, fix second regression test, add descriptive comments. * check for error message * one more test --------- Co-authored-by: lollerfirst <43107113+lollerfirst@users.noreply.github.com> Co-authored-by: lollerfirst <lollerfirst@gmail.com>
This commit is contained in:
@@ -133,17 +133,19 @@ class LedgerVerification(
|
||||
if not self._verify_no_duplicate_outputs(outputs):
|
||||
raise TransactionDuplicateOutputsError()
|
||||
# verify that outputs have not been signed previously
|
||||
signed_before = await self._check_outputs_issued_before(outputs, conn)
|
||||
signed_before = await self._check_outputs_pending_or_issued_before(
|
||||
outputs, conn
|
||||
)
|
||||
if any(signed_before):
|
||||
raise OutputsAlreadySignedError()
|
||||
logger.trace(f"Verified {len(outputs)} outputs.")
|
||||
|
||||
async def _check_outputs_issued_before(
|
||||
async def _check_outputs_pending_or_issued_before(
|
||||
self,
|
||||
outputs: List[BlindedMessage],
|
||||
conn: Optional[Connection] = None,
|
||||
) -> List[bool]:
|
||||
"""Checks whether the provided outputs have previously been signed by the mint
|
||||
"""Checks whether the provided outputs have previously stored (as blinded messages) been signed (as blind signatures) by the mint
|
||||
(which would lead to a duplication error later when trying to store these outputs again).
|
||||
|
||||
Args:
|
||||
@@ -153,7 +155,7 @@ class LedgerVerification(
|
||||
result (List[bool]): Whether outputs are already present in the database.
|
||||
"""
|
||||
async with self.db.get_connection(conn) as conn:
|
||||
promises = await self.crud.get_promises(
|
||||
promises = await self.crud.get_outputs(
|
||||
b_s=[output.B_ for output in outputs], db=self.db, conn=conn
|
||||
)
|
||||
return [True if promise else False for promise in promises]
|
||||
|
||||
Reference in New Issue
Block a user