Skip to content

Commit

Permalink
Add check for correctly-sized signature witness. (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerjohn authored Mar 15, 2021
1 parent f6219cd commit 4689fe7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion specs/protocol/tx_validity.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ def address_from(pubkey: bytes) -> bytes:

for input in tx.inputs:
if input.type == InputType.Coin and input.predicateLength == 0:
if address_from(ecrecover(txhash(), tx.witnesses[input.witnessIndex])) != state[input.utxoID].owner:
# ECDSA signatures must be 64 bytes
if tx.witnesses[input.witnessIndex].dataLength != 64:
return False
# Signature must be from owner
if address_from(ecrecover(txhash(), tx.witnesses[input.witnessIndex].data)) != state[input.utxoID].owner:
return False
return True
```
Expand Down

0 comments on commit 4689fe7

Please sign in to comment.