sign outputs as bytes (#399)

This commit is contained in:
callebtc
2024-01-25 23:22:16 +01:00
committed by GitHub
parent 7b5192c27a
commit bc2b555c16
2 changed files with 4 additions and 4 deletions

View File

@@ -154,7 +154,7 @@ class LedgerSpendingConditions:
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),
):
@@ -181,7 +181,7 @@ class LedgerSpendingConditions:
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),
):
@@ -305,7 +305,7 @@ class LedgerSpendingConditions:
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),
):

View File

@@ -93,7 +93,7 @@ class WalletP2PK(SupportsPrivateKey, SupportsDb):
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