Changeset View
Changeset View
Standalone View
Standalone View
src/test/key_io_tests.cpp
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | for (unsigned int idx = 0; idx < tests.size(); idx++) { | ||||
// Allow for extra stuff (useful for comments) | // Allow for extra stuff (useful for comments) | ||||
if (test.size() < 1) { | if (test.size() < 1) { | ||||
BOOST_ERROR("Bad test: " << strTest); | BOOST_ERROR("Bad test: " << strTest); | ||||
continue; | continue; | ||||
} | } | ||||
std::string exp_base58string = test[0].get_str(); | std::string exp_base58string = test[0].get_str(); | ||||
// must be invalid as public and as private key | // must be invalid as public and as private key | ||||
for (auto chain : {CBaseChainParams::MAIN, CBaseChainParams::TESTNET, | for (const auto &chain : | ||||
{CBaseChainParams::MAIN, CBaseChainParams::TESTNET, | |||||
CBaseChainParams::REGTEST}) { | CBaseChainParams::REGTEST}) { | ||||
SelectParams(chain); | SelectParams(chain); | ||||
destination = DecodeLegacyAddr(exp_base58string, Params()); | destination = DecodeLegacyAddr(exp_base58string, Params()); | ||||
BOOST_CHECK_MESSAGE(!IsValidDestination(destination), | BOOST_CHECK_MESSAGE(!IsValidDestination(destination), | ||||
"IsValid pubkey in mainnet:" + strTest); | "IsValid pubkey in mainnet:" + strTest); | ||||
privkey = DecodeSecret(exp_base58string); | privkey = DecodeSecret(exp_base58string); | ||||
BOOST_CHECK_MESSAGE(!privkey.IsValid(), | BOOST_CHECK_MESSAGE(!privkey.IsValid(), | ||||
"IsValid privkey in mainnet:" + strTest); | "IsValid privkey in mainnet:" + strTest); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |