From 6d300e84d454ddd4adfb54f20d267f3f7579ab8b Mon Sep 17 00:00:00 2001 From: Benjamin Woosley Date: Mon, 26 Feb 2024 18:03:41 -0300 Subject: [PATCH] test: Don't redundantly define msg in key_tests test/key_tests.cpp:184:21: error: declaration shadows a local variable [-Werror,-Wshadow] std::string msg = "A message to be signed" + ToString(i); ^ test/key_tests.cpp:161:17: note: previous declaration is here std::string msg = "A message to be signed"; ^ --- src/test/key_tests.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index 90e04bed87..36d189e471 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -166,8 +166,7 @@ BOOST_AUTO_TEST_CASE(key_signature_tests) { // When entropy is specified, we should see at least one high R signature within 20 signatures CKey key = DecodeSecret(strSecret1); - std::string msg = "A message to be signed"; - uint256 msg_hash = Hash(msg); + uint256 msg_hash = Hash("A message to be signed"); std::vector sig; bool found = false; @@ -189,8 +188,7 @@ BOOST_AUTO_TEST_CASE(key_signature_tests) bool bad_sign = false; for (int i = 0; i < 256; ++i) { sig.clear(); - std::string msg = "A message to be signed" + ToString(i); - msg_hash = Hash(msg); + msg_hash = Hash("A message to be signed" + ToString(i)); if (!key.Sign(msg_hash, sig)) { bad_sign = true; break;