diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-05-09 16:24:46 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-05-09 16:24:57 +0200 |
commit | 72f754cf51d09ea9c3daec398da7a8ca7fce8d6e (patch) | |
tree | 39835783d027e3d879d9ac3fd9e94fbf049fcd5a /src/test | |
parent | 54f102248b183618ed7bd198c995232c89dc3152 (diff) | |
parent | 6fd7ef2bbf1f941c8dee302ffdeb44e603148723 (diff) |
Merge pull request #3637
6fd7ef2 Also switch the (unused) verification code to low-s instead of even-s. (Pieter Wuille)
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/canonical_tests.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/canonical_tests.cpp b/src/test/canonical_tests.cpp index a26ad335a4..23dd74296c 100644 --- a/src/test/canonical_tests.cpp +++ b/src/test/canonical_tests.cpp @@ -93,4 +93,21 @@ BOOST_AUTO_TEST_CASE(script_noncanon) } } +BOOST_AUTO_TEST_CASE(script_signstrict) +{ + for (int i=0; i<100; i++) { + CKey key; + key.MakeNewKey(i & 1); + std::vector<unsigned char> sig; + uint256 hash = GetRandHash(); + + BOOST_CHECK(key.Sign(hash, sig)); // Generate a random signature. + BOOST_CHECK(key.GetPubKey().Verify(hash, sig)); // Check it. + sig.push_back(0x01); // Append a sighash type. + + BOOST_CHECK(IsCanonicalSignature(sig, SCRIPT_VERIFY_STRICTENC | SCRIPT_VERIFY_LOW_S)); + BOOST_CHECK(IsCanonicalSignature_OpenSSL(sig)); + } +} + BOOST_AUTO_TEST_SUITE_END() |