Skip to content

Commit

Permalink
outputs also use witness field
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Oct 13, 2023
1 parent 046af1d commit 565cff3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cashu/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ class BlindedMessage(BaseModel):

amount: int
B_: str # Hex-encoded blinded message
p2pksigs: Union[List[str], None] = None # signature for p2pk with SIG_ALL
witness: Union[str, None] = None # witnesses (used for P2PK with SIG_ALL)

@property
def p2pksigs(self) -> List[str]:
assert self.witness, "Witness is missing"
return P2PKWitness.from_witness(self.witness).signatures


class BlindedSignature(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion cashu/wallet/p2pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def add_p2pk_witnesses_to_outputs(
"""
p2pk_signatures = await self.sign_p2pk_outputs(outputs)
for o, s in zip(outputs, p2pk_signatures):
o.p2pksigs = [s]
o.witness = P2PKWitness(signatures=[s]).json()
return outputs

async def add_witnesses_to_outputs(
Expand Down

0 comments on commit 565cff3

Please sign in to comment.