mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 18:53:21 +01:00
use 'byte'/'bytes' for bech32(m) validation error
changed from std::string -> std::string_view applied snake case to byteStr -> byte_str
This commit is contained in:
@@ -146,6 +146,9 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par
|
||||
// The rest of the symbols are converted witness program bytes.
|
||||
data.reserve(((dec.data.size() - 1) * 5) / 8);
|
||||
if (ConvertBits<5, 8, false>([&](unsigned char c) { data.push_back(c); }, dec.data.begin() + 1, dec.data.end())) {
|
||||
|
||||
std::string_view byte_str{data.size() == 1 ? "byte" : "bytes"};
|
||||
|
||||
if (version == 0) {
|
||||
{
|
||||
WitnessV0KeyHash keyid;
|
||||
@@ -162,7 +165,7 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par
|
||||
}
|
||||
}
|
||||
|
||||
error_str = strprintf("Invalid Bech32 v0 address program size (%s byte), per BIP141", data.size());
|
||||
error_str = strprintf("Invalid Bech32 v0 address program size (%d %s), per BIP141", data.size(), byte_str);
|
||||
return CNoDestination();
|
||||
}
|
||||
|
||||
@@ -179,7 +182,7 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par
|
||||
}
|
||||
|
||||
if (data.size() < 2 || data.size() > BECH32_WITNESS_PROG_MAX_LEN) {
|
||||
error_str = strprintf("Invalid Bech32 address program size (%s byte)", data.size());
|
||||
error_str = strprintf("Invalid Bech32 address program size (%d %s)", data.size(), byte_str);
|
||||
return CNoDestination();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user