mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Make DecodeBase{32,64} return optional instead of taking bool*
This commit is contained in:
@@ -69,12 +69,11 @@ static std::string SwapBase64(const std::string& from)
|
||||
static Binary DecodeI2PBase64(const std::string& i2p_b64)
|
||||
{
|
||||
const std::string& std_b64 = SwapBase64(i2p_b64);
|
||||
bool invalid;
|
||||
Binary decoded = DecodeBase64(std_b64, &invalid);
|
||||
if (invalid) {
|
||||
auto decoded = DecodeBase64(std_b64);
|
||||
if (!decoded) {
|
||||
throw std::runtime_error(strprintf("Cannot decode Base64: \"%s\"", i2p_b64));
|
||||
}
|
||||
return decoded;
|
||||
return std::move(*decoded);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user