diff options
| author | Gregory Maxwell <[email protected]> | 2014-02-11 12:44:42 -0800 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2014-02-11 12:44:42 -0800 |
| commit | 2bc52f1c4a7d66661ed26e100a914e68df6d2bcc (patch) | |
| tree | 193f73d99ddbd70a67b5aafdcf353174f2cf4a96 /src/test/script_tests.cpp | |
| parent | Merge pull request #3622 (diff) | |
| parent | Add HasCanonicalPushes(), and use it in IsStandardTx (diff) | |
| download | discoin-2bc52f1c4a7d66661ed26e100a914e68df6d2bcc.tar.xz discoin-2bc52f1c4a7d66661ed26e100a914e68df6d2bcc.zip | |
Merge pull request #3025 from sipa/noncanpush
Make signatures with non-canonical data pushes non-standard.
Diffstat (limited to 'src/test/script_tests.cpp')
| -rw-r--r-- | src/test/script_tests.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index dee0f110a..dd1b61304 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -438,4 +438,22 @@ BOOST_AUTO_TEST_CASE(script_combineSigs) BOOST_CHECK(combined == partial3c); } +BOOST_AUTO_TEST_CASE(script_standard_push) +{ + for (int i=0; i<1000; i++) { + CScript script; + script << i; + BOOST_CHECK_MESSAGE(script.IsPushOnly(), "Number " << i << " is not pure push."); + BOOST_CHECK_MESSAGE(script.HasCanonicalPushes(), "Number " << i << " push is not canonical."); + } + + for (int i=0; i<1000; i++) { + std::vector<unsigned char> data(i, '\111'); + CScript script; + script << data; + BOOST_CHECK_MESSAGE(script.IsPushOnly(), "Length " << i << " is not pure push."); + BOOST_CHECK_MESSAGE(script.HasCanonicalPushes(), "Length " << i << " push is not canonical."); + } +} + BOOST_AUTO_TEST_SUITE_END() |