Raise the 90-character limit on Bech32 encodings

Regtest addresses are 91 characters, and ZIP 32's Bech32 encoding will
be significantly longer.
This commit is contained in:
Jack Grigg 2018-07-09 23:41:41 +01:00
parent 4715b31c76
commit 281b51e567
No known key found for this signature in database
GPG Key ID: 1B8D649257DB0829
2 changed files with 2 additions and 2 deletions

View File

@ -169,7 +169,7 @@ std::pair<std::string, data> Decode(const std::string& str) {
}
if (lower && upper) return {};
size_t pos = str.rfind('1');
if (str.size() > 90 || pos == str.npos || pos == 0 || pos + 7 > str.size()) {
if (str.size() > 1023 || pos == str.npos || pos == 0 || pos + 7 > str.size()) {
return {};
}
data values(str.size() - 1 - pos);

View File

@ -28,6 +28,7 @@ BOOST_AUTO_TEST_CASE(bip173_testvectors_valid)
"A12UEL5L",
"a12uel5l",
"an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs",
"an84characterslonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1569pvx",
"abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw",
"11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j",
"split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w",
@ -48,7 +49,6 @@ BOOST_AUTO_TEST_CASE(bip173_testvectors_invalid)
" 1nwldj5",
"\x7f""1axkwrx",
"\x80""1eym55h",
"an84characterslonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1569pvx",
"pzry9x0s0muk",
"1pzry9x0s0muk",
"x1b4n0q5v",