Skip to content

Commit

Permalink
Merge pull request #4 from conduition/dlc3
Browse files Browse the repository at this point in the history
fix funding proof signatures to match spec
  • Loading branch information
lollerfirst authored Aug 23, 2024
2 parents c38b2ed + 47ace2f commit 9213daf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cashu/core/crypto/dlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ def sign_dlc(
) -> bytes:
message = (
bytes.fromhex(dlc_root)
+str(funding_amount).encode("utf-8")
+funding_amount.to_bytes(8, "big")
)
message_hash = sha256(message).digest()
return privkey.schnorr_sign(message_hash, None, raw=True)
return privkey.schnorr_sign(message, None, raw=True)

def verify_dlc_signature(
dlc_root: str,
Expand All @@ -83,7 +82,6 @@ def verify_dlc_signature(
) -> bool:
message = (
bytes.fromhex(dlc_root)
+str(funding_amount).encode("utf-8")
+funding_amount.to_bytes(8, "big")
)
message_hash = sha256(message).digest()
return pubkey.schnorr_verify(message_hash, signature, None, raw=True)
return pubkey.schnorr_verify(message, signature, None, raw=True)

0 comments on commit 9213daf

Please sign in to comment.