diff options
| author | Peter Todd <[email protected]> | 2014-08-24 21:16:51 -0400 |
|---|---|---|
| committer | Peter Todd <[email protected]> | 2014-08-24 21:16:51 -0400 |
| commit | aa41ac216eb51d61512b4cadc95c809e094215ce (patch) | |
| tree | abfac83f5aee505a2e450cfb3e52c61f4aa7e21b /src/test/script_tests.cpp | |
| parent | Merge pull request #4683 (diff) | |
| download | discoin-aa41ac216eb51d61512b4cadc95c809e094215ce.tar.xz discoin-aa41ac216eb51d61512b4cadc95c809e094215ce.zip | |
Test IsPushOnly() with invalid push
Diffstat (limited to 'src/test/script_tests.cpp')
| -rw-r--r-- | src/test/script_tests.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index bc9f31c07..77c44501a 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -394,4 +394,15 @@ BOOST_AUTO_TEST_CASE(script_standard_push) } } +BOOST_AUTO_TEST_CASE(script_IsPushOnly_on_invalid_scripts) +{ + // IsPushOnly returns false when given a script containing only pushes that + // are invalid due to truncation. IsPushOnly() is consensus critical + // because P2SH evaluation uses it, although this specific behavior should + // not be consensus critical as the P2SH evaluation would fail first due to + // the invalid push. Still, it doesn't hurt to test it explicitly. + static const unsigned char direct[] = { 1 }; + BOOST_CHECK(!CScript(direct, direct+sizeof(direct)).IsPushOnly()); +} + BOOST_AUTO_TEST_SUITE_END() |