scripted-diff: Rename SetHex to SetHexDeprecated

SetHex is fragile, because it accepts any non-hex input or any length of
input, without error feedback. This can lead to issues when the input is
truncated or otherwise corrupted.

Document the problem by renaming the method.

In the future, the fragile method should be removed from the public
interface.

-BEGIN VERIFY SCRIPT-
 sed -i 's/SetHex/SetHexDeprecated/g' $( git grep -l SetHex ./src )
-END VERIFY SCRIPT-
This commit is contained in:
MarcoFalke
2024-07-18 22:24:38 +02:00
parent fafe4b8051
commit fa103db2bb
6 changed files with 19 additions and 19 deletions

View File

@@ -18,7 +18,7 @@ std::string base_blob<BITS>::GetHex() const
}
template <unsigned int BITS>
void base_blob<BITS>::SetHex(const std::string_view str)
void base_blob<BITS>::SetHexDeprecated(const std::string_view str)
{
std::fill(m_data.begin(), m_data.end(), 0);
@@ -52,12 +52,12 @@ std::string base_blob<BITS>::ToString() const
// Explicit instantiations for base_blob<160>
template std::string base_blob<160>::GetHex() const;
template std::string base_blob<160>::ToString() const;
template void base_blob<160>::SetHex(std::string_view);
template void base_blob<160>::SetHexDeprecated(std::string_view);
// Explicit instantiations for base_blob<256>
template std::string base_blob<256>::GetHex() const;
template std::string base_blob<256>::ToString() const;
template void base_blob<256>::SetHex(std::string_view);
template void base_blob<256>::SetHexDeprecated(std::string_view);
const uint256 uint256::ZERO(0);
const uint256 uint256::ONE(1);