Page MenuHomePhabricator

test: add unit test for non-standard "scriptsig-not-pushonly" txs
ClosedPublic

Authored by PiRK on Jan 11 2021, 14:10.

Details

Summary

The function IsStandardTx() returns rejection reason "scriptsig-not-pushonly"
if the transaction has at least one input for which the scriptSig consists of
any other ops than just PUSHs.

This is a a backport of Core PR17720

Test Plan

ninja && ninja check

Event Timeline

PiRK requested review of this revision.Jan 11 2021, 14:10

Tail of the build log:

[153/427] Running utility command for check-pow-grasberg_tests
[154/427] Building CXX object src/seeder/test/CMakeFiles/test-seeder.dir/write_name_tests.cpp.o
[155/427] Test Bitcoin RPC authentication...
...
----------------------------------------------------------------------
Ran 3 tests in 0.004s

OK
[156/427] Automatic MOC for target test_bitcoin-qt
[157/427] cd /work/contrib/devtools/chainparams && /usr/bin/python3.7 ./test_make_chainparams.py
.....
----------------------------------------------------------------------
Ran 5 tests in 0.001s

OK
[158/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/__/wallet/test/init_tests.cpp.o
[159/427] Test Bitcoin utilities...
[160/427] Building CXX object src/seeder/test/CMakeFiles/test-seeder.dir/parse_name_tests.cpp.o
[161/427] pow: testing aserti32d_tests
[162/427] Building CXX object src/seeder/test/CMakeFiles/test-seeder.dir/p2p_messaging_tests.cpp.o
[163/427] Running utility command for check-pow-aserti32d_tests
[164/427] Running pow test suite
PASSED: pow test suite
[165/427] Linking CXX executable src/seeder/test/test-seeder
[166/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/__/wallet/test/wallet_crypto_tests.cpp.o
[167/427] seeder: testing message_writer_tests
[168/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/bitcoinaddressvalidatortests.cpp.o
[169/427] Running utility command for check-seeder-message_writer_tests
[170/427] seeder: testing p2p_messaging_tests
[171/427] seeder: testing parse_name_tests
[172/427] Running utility command for check-seeder-p2p_messaging_tests
[173/427] Running utility command for check-seeder-parse_name_tests
[174/427] seeder: testing write_name_tests
[175/427] Running utility command for check-seeder-write_name_tests
[176/427] Running seeder test suite
PASSED: seeder test suite
[177/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/__/wallet/test/ismine_tests.cpp.o
[178/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/compattests.cpp.o
[179/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/__/wallet/test/walletdb_tests.cpp.o
[180/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/test_bitcoin-qt_autogen/mocs_compilation.cpp.o
[181/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/util.cpp.o
[182/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/__/wallet/test/psbt_wallet_tests.cpp.o
[183/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/guiutiltests.cpp.o
[184/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/__/wallet/test/coinselector_tests.cpp.o
[185/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/uritests.cpp.o
[186/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/apptests.cpp.o
[187/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/__/wallet/test/wallet_tests.cpp.o
[188/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/rpcnestedtests.cpp.o
[189/427] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/util_tests.cpp.o
[190/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/test_main.cpp.o
[191/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/paymentservertests.cpp.o
[192/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/__/__/wallet/test/wallet_test_fixture.cpp.o
[193/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/addressbooktests.cpp.o
[194/427] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/wallettests.cpp.o
[195/427] Linking CXX executable src/qt/test/test_bitcoin-qt
[196/427] bitcoin-qt: testing test_bitcoin-qt
[197/427] Running bitcoin-qt test suite
PASSED: bitcoin-qt test suite
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
majcosta requested changes to this revision.Jan 11 2021, 17:30
majcosta added a subscriber: majcosta.

this is PR17720 right? missing in the summary

src/test/transaction_tests.cpp
837 ↗(On Diff #26848)

braces

This revision now requires changes to proceed.Jan 11 2021, 17:30

add braces, mention PR number for backport in the description, put a few comments on their own line to improve the scriptSig layout

majcosta requested changes to this revision.Jan 12 2021, 10:32
majcosta added inline comments.
src/test/transaction_tests.cpp
804 ↗(On Diff #26866)

first comment goes above this line.

you could also fiddle with // clang-format off/on so that << OP_TRUE << OP_0 << OP_1NEGATE << OP_16 sticks to a single line, but that's probably overkill

836 ↗(On Diff #26866)

comment on its own line

844 ↗(On Diff #26866)

ditto

851 ↗(On Diff #26866)

ditto

This revision now requires changes to proceed.Jan 12 2021, 10:32

more comments on the own line, fix comment location scriptSig

This revision is now accepted and ready to land.Jan 12 2021, 11:16