diff options
author | Lőrinc <pap.lorinc@gmail.com> | 2024-03-09 13:31:40 +0100 |
---|---|---|
committer | Lőrinc <pap.lorinc@gmail.com> | 2024-06-05 12:46:39 +0200 |
commit | d5ece3c4b5e109f65f5d3315c43239dd87bb2c81 (patch) | |
tree | 709f6d42b54a6ba3975399b256f703d7c1cda827 | |
parent | ff7d2054c4f1d7ff98078b9695e7c36e79a476c6 (diff) | |
download | bitcoin-d5ece3c4b5e109f65f5d3315c43239dd87bb2c81.tar.xz |
Reserve hrp memory in Decode and LocateErrors
-rw-r--r-- | src/bech32.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bech32.cpp b/src/bech32.cpp index c3c4ca8006..fafd2007a6 100644 --- a/src/bech32.cpp +++ b/src/bech32.cpp @@ -393,6 +393,7 @@ DecodeResult Decode(const std::string& str, CharLimit limit) { values[i] = rev; } std::string hrp; + hrp.reserve(pos); for (size_t i = 0; i < pos; ++i) { hrp += LowerCase(str[i]); } @@ -425,6 +426,7 @@ std::pair<std::string, std::vector<int>> LocateErrors(const std::string& str, Ch } std::string hrp; + hrp.reserve(pos); for (size_t i = 0; i < pos; ++i) { hrp += LowerCase(str[i]); } |