Page MenuHomePhabricator

test: add vectors for the SIGHASH single bug
ClosedPublic

Authored by PiRK on Thu, Oct 30, 12:26.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCae02ef358df4: test: add vectors for the SIGHASH single bug
Summary

We take a mainnet transaction knwon to trigger the sighash_single bug (txid: 99fc1e5c753459808bac56435b3d45f2fcf0dd73016ea14460d63e9ddf353714), and we pass it to SignatureHash function with two different sighash types:

  • SINGLE (pre-UAHF tx): in this case the signature hash is 1 for any flag combination
  • SINGLE | FORKID (0x03 | 0x40 = 0x43 = 67): in this case the signature hash is 1 only if the SCRIPT_ENABLE_SIGHASH_FORKID flag is not set

This is done for input index 2, for a transaction that has only one output, thus triggering the nOut out of range issue.

Test Plan

ninja check

Event Timeline

PiRK added inline comments.
src/test/data/sighash.json
1003–1004
["raw_transaction, script, input_index, hashType, signature_hash (regular), signature_hash(no forkid), signature_hash(replay protected)"],
This revision is now accepted and ready to land.Thu, Oct 30, 20:51
This revision was automatically updated to reflect the committed changes.