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:
callebtc
2025-04-25 11:37:19 +02:00
committed by GitHub
parent 8d94d1097b
commit 7abfc68cfa
23 changed files with 2517 additions and 432 deletions

View File

@@ -283,16 +283,16 @@ async def pay(
abort=True,
default=True,
)
if wallet.available_balance < total_amount + ecash_fees:
print(" Error: Balance too low.")
return
assert total_amount > 0, "amount is not positive"
# we need to include fees so we can use the proofs for melting the `total_amount`
send_proofs, _ = await wallet.select_to_send(
wallet.proofs, total_amount, include_fees=True, set_reserved=True
)
print("Paying Lightning invoice ...", end="", flush=True)
assert total_amount > 0, "amount is not positive"
if wallet.available_balance < total_amount:
print(" Error: Balance too low.")
return
try:
melt_response = await wallet.melt(
send_proofs, invoice, quote.fee_reserve, quote.quote
@@ -764,12 +764,17 @@ async def receive_cli(
return
await print_balance(ctx)
@cli.command("decode", help="Decode a cashu token and print in JSON format.")
@click.option(
"--no-dleq", default=False, is_flag=True, help="Do not include DLEQ proofs."
)
@click.option(
"--indent", "-i", default=2, is_flag=False, help="Number of spaces to indent JSON with."
"--indent",
"-i",
default=2,
is_flag=False,
help="Number of spaces to indent JSON with.",
)
@click.argument("token", type=str, default="")
def decode_to_json(token: str, no_dleq: bool, indent: int):
@@ -785,6 +790,7 @@ def decode_to_json(token: str, no_dleq: bool, indent: int):
else:
print("Error: enter a token")
@cli.command("burn", help="Burn spent tokens.")
@click.argument("token", required=False, type=str)
@click.option("--all", "-a", default=False, is_flag=True, help="Burn all spent tokens.")