diff options
Diffstat (limited to 'src/test/key_tests.cpp')
-rw-r--r-- | src/test/key_tests.cpp | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index aaf4ca4977..b897a0a153 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -19,6 +19,8 @@ #include <boost/test/unit_test.hpp> +using util::ToString; + static const std::string strSecret1 = "5HxWvvfubhXpYYpS3tJkw6fq9jE9j18THftkZjHHfmFiWtmAbrj"; static const std::string strSecret2 = "5KC4ejrDjv152FGwP386VD1i2NYc5KkfSMyv1nGy1VGDxGHqVY3"; static const std::string strSecret1C = "Kwr371tjA9u2rFSMZjTNun2PXXP3WPZu2afRHTcta6KxEUdm1vEw"; @@ -201,37 +203,6 @@ BOOST_AUTO_TEST_CASE(key_signature_tests) BOOST_CHECK(found_small); } -BOOST_AUTO_TEST_CASE(key_key_negation) -{ - // create a dummy hash for signature comparison - unsigned char rnd[8]; - std::string str = "Bitcoin key verification\n"; - GetRandBytes(rnd); - uint256 hash{Hash(str, rnd)}; - - // import the static test key - CKey key = DecodeSecret(strSecret1C); - - // create a signature - std::vector<unsigned char> vch_sig; - std::vector<unsigned char> vch_sig_cmp; - key.Sign(hash, vch_sig); - - // negate the key twice - BOOST_CHECK(key.GetPubKey().data()[0] == 0x03); - key.Negate(); - // after the first negation, the signature must be different - key.Sign(hash, vch_sig_cmp); - BOOST_CHECK(vch_sig_cmp != vch_sig); - BOOST_CHECK(key.GetPubKey().data()[0] == 0x02); - key.Negate(); - // after the second negation, we should have the original key and thus the - // same signature - key.Sign(hash, vch_sig_cmp); - BOOST_CHECK(vch_sig_cmp == vch_sig); - BOOST_CHECK(key.GetPubKey().data()[0] == 0x03); -} - static CPubKey UnserializePubkey(const std::vector<uint8_t>& data) { DataStream stream{}; |