diff options
| author | Pieter Wuille <[email protected]> | 2015-02-05 21:26:15 -0800 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2015-10-18 13:28:59 +0000 |
| commit | cdb81cec3fe154abb78a025a8f5fabe18dd0fbb3 (patch) | |
| tree | c5b83d183b017d0bb7a66455a414c40ef154e2de /src/test/script_tests.cpp | |
| parent | Raise version of created blocks, and enforce DERSIG in mempool (diff) | |
| download | discoin-cdb81cec3fe154abb78a025a8f5fabe18dd0fbb3.tar.xz discoin-cdb81cec3fe154abb78a025a8f5fabe18dd0fbb3.zip | |
Backport of some of BIP66's tests
Diffstat (limited to 'src/test/script_tests.cpp')
| -rw-r--r-- | src/test/script_tests.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index 29d518d70..0875f6129 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -144,8 +144,13 @@ BOOST_AUTO_TEST_CASE(script_valid) string scriptPubKeyString = test[1].get_str(); CScript scriptPubKey = ParseScript(scriptPubKeyString); + int flagsNow = flags; + if (test.size() > 3 && ("," + test[2].get_str() + ",").find(",DERSIG,") != string::npos) { + flagsNow |= SCRIPT_VERIFY_DERSIG; + } + CTransaction tx; - BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, tx, 0, flags, SIGHASH_NONE), strTest); + BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, tx, 0, flagsNow, SIGHASH_NONE), strTest); } } @@ -168,8 +173,13 @@ BOOST_AUTO_TEST_CASE(script_invalid) string scriptPubKeyString = test[1].get_str(); CScript scriptPubKey = ParseScript(scriptPubKeyString); + int flagsNow = flags; + if (test.size() > 3 && ("," + test[2].get_str() + ",").find(",DERSIG,") != string::npos) { + flagsNow |= SCRIPT_VERIFY_DERSIG; + } + CTransaction tx; - BOOST_CHECK_MESSAGE(!VerifyScript(scriptSig, scriptPubKey, tx, 0, flags, SIGHASH_NONE), strTest); + BOOST_CHECK_MESSAGE(!VerifyScript(scriptSig, scriptPubKey, tx, 0, flagsNow, SIGHASH_NONE), strTest); } } |