Page MenuHomePhabricator

Decodehextx scripts sanity check
ClosedPublic

Authored by deadalnix on Oct 12 2019, 01:07.

Details

Summary
  • Add a valid opcode sanity check to CScript

Added a function in CScript that checks if the script contains valid opcodes.

Add a test for that function

  • Sanity check transaction scripts in DecodeHexTx

Make sure that the scripts of decoded transactions are valid scripts.

This is a backport of Core PR10481

This include a bugfix to the integration test suite, as bogous transactions where generated in there.

Test Plan
make check
./test/functional/test_runner.py --extended

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Oct 14 2019, 06:18

This seems to just remove functionality and Core only did this because they have problems telling apart segwit txns from partially constructed non-segwit transactions (see discussion on PR). This isn't a crutch that we need to be copying.

src/core_read.cpp
194

This is actually a bit silly, since there are no consensus rules on output scripts.

So, if you try to run decoderawtransaction on some real transactions that are in chain, then it fails now :/ For example, try:

bitcoin-cli decoderawtransaction `bitcoin-cli getrawtransaction 77822fd6663c665104119cb7635352756dfc50da76a92d417ec1a12c518fad69`