mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-21 11:04:19 +01:00
SIG_ALL signature flag for P2PK (#735)
* n_sigs_refund working, tests added * update requirements * wip sigall * wip * sigall works * add signatures for refund * add mint p2pk tests * add more p2pk tests * fix tests * sign htlc pubkeys as well * fix htlc and add new test * fix regtest * fix new tests with deprecated * remove asserts * comments * new wallet p2pk tests * getting there * add more tests * fixes * refactor htlc and p2pk validation * reduce code * melt with sigall * fix htlcs * fix deprecated api tests * Update cashu/mint/conditions.py Co-authored-by: lollerfirst <43107113+lollerfirst@users.noreply.github.com> * refactor sigall validation --------- Co-authored-by: lollerfirst <43107113+lollerfirst@users.noreply.github.com>
This commit is contained in:
@@ -130,10 +130,9 @@ async def send(
|
||||
assert len(lock) > 21, Exception(
|
||||
"Error: lock has to be at least 22 characters long."
|
||||
)
|
||||
if not lock.startswith("P2PK:"):
|
||||
raise Exception("Error: lock has to start with P2PK:")
|
||||
# we add a time lock to the P2PK lock by appending the current unix time + 14 days
|
||||
else:
|
||||
if lock.startswith("P2PK:") or lock.startswith("P2PK-SIGALL:"):
|
||||
sigall = lock.startswith("P2PK-SIGALL:")
|
||||
logger.debug(f"Locking token to: {lock}")
|
||||
logger.debug(
|
||||
f"Adding a time lock of {settings.locktime_delta_seconds} seconds."
|
||||
@@ -141,10 +140,12 @@ async def send(
|
||||
secret_lock = await wallet.create_p2pk_lock(
|
||||
lock.split(":")[1],
|
||||
locktime_seconds=settings.locktime_delta_seconds,
|
||||
sig_all=False,
|
||||
sig_all=sigall,
|
||||
n_sigs=1,
|
||||
)
|
||||
logger.debug(f"Secret lock: {secret_lock}")
|
||||
else:
|
||||
raise Exception("Error: lock has to start with P2PK: or P2PK-SIGALL:")
|
||||
|
||||
await wallet.load_proofs()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user