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

@@ -193,17 +193,26 @@ class Proof(BaseModel):
@property
def p2pksigs(self) -> List[str]:
assert self.witness, "Witness is missing for p2pk signature"
return P2PKWitness.from_witness(self.witness).signatures
try:
return P2PKWitness.from_witness(self.witness).signatures
except Exception:
return []
@property
def htlcpreimage(self) -> str | None:
assert self.witness, "Witness is missing for htlc preimage"
return HTLCWitness.from_witness(self.witness).preimage
try:
return HTLCWitness.from_witness(self.witness).preimage
except Exception:
return None
@property
def htlcsigs(self) -> List[str] | None:
assert self.witness, "Witness is missing for htlc signatures"
return HTLCWitness.from_witness(self.witness).signatures
try:
return HTLCWitness.from_witness(self.witness).signatures
except Exception:
return None
class Proofs(BaseModel):
@@ -219,12 +228,6 @@ class BlindedMessage(BaseModel):
amount: int
id: str # Keyset id
B_: str # Hex-encoded blinded message
witness: Union[str, None] = None # witnesses (used for P2PK with SIG_ALL)
@property
def p2pksigs(self) -> List[str]:
assert self.witness, "Witness missing in output"
return P2PKWitness.from_witness(self.witness).signatures
class BlindedMessage_Deprecated(BaseModel):