Skip to content

Commit

Permalink
sign outputs as bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Jan 25, 2024
1 parent 7b5192c commit 2dae73d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cashu/mint/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _verify_htlc_spending_conditions(self, proof: Proof, secret: Secret) -> bool
assert signature, TransactionError("no HTLC refund signature provided")
for pubkey in refund_pubkeys:
if verify_p2pk_signature(
message=htlc_secret.serialize().encode("utf-8"),
message=proof.secret.encode("utf-8"),
pubkey=PublicKey(bytes.fromhex(pubkey), raw=True),
signature=bytes.fromhex(signature),
):
Expand All @@ -181,7 +181,7 @@ def _verify_htlc_spending_conditions(self, proof: Proof, secret: Secret) -> bool
assert signature, TransactionError("HTLC no hash lock signatures provided.")
for pubkey in hashlock_pubkeys:
if verify_p2pk_signature(
message=htlc_secret.serialize().encode("utf-8"),
message=proof.secret.encode("utf-8"),
pubkey=PublicKey(bytes.fromhex(pubkey), raw=True),
signature=bytes.fromhex(signature),
):
Expand Down Expand Up @@ -305,7 +305,7 @@ def _verify_output_p2pk_spending_conditions(
for sig in p2pksigs:
for pubkey in pubkeys:
if verify_p2pk_signature(
message=output.B_.encode("utf-8"),
message=bytes.fromhex(output.B_),
pubkey=PublicKey(bytes.fromhex(pubkey), raw=True),
signature=bytes.fromhex(sig),
):
Expand Down
2 changes: 1 addition & 1 deletion cashu/wallet/p2pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def sign_p2pk_outputs(self, outputs: List[BlindedMessage]) -> List[str]:
assert private_key.pubkey
return [
sign_p2pk_sign(
message=output.B_.encode("utf-8"),
message=bytes.fromhex(output.B_),
private_key=private_key,
).hex()
for output in outputs
Expand Down

0 comments on commit 2dae73d

Please sign in to comment.