diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2014-08-26 16:49:41 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2014-08-26 16:50:17 +0200 |
commit | 727298cef34005c523117adbb2249c8df2c7f89d (patch) | |
tree | 2394c438b350e12433256cff803e1b3654cdf7c0 /src/test | |
parent | 790911ff0a659becd983afd5309b2c16401ba28d (diff) | |
parent | aa41ac216eb51d61512b4cadc95c809e094215ce (diff) |
Merge pull request #4763
aa41ac2 Test IsPushOnly() with invalid push (Peter Todd)
Diffstat (limited to 'src/test')
-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 bc9f31c077..77c44501ab 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() |