Changeset View
Changeset View
Standalone View
Standalone View
src/test/cashaddrenc_tests.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
// Check that an encoded cash address is not valid on another network. | // Check that an encoded cash address is not valid on another network. | ||||
BOOST_AUTO_TEST_CASE(invalid_on_wrong_network) { | BOOST_AUTO_TEST_CASE(invalid_on_wrong_network) { | ||||
const CTxDestination dst = CKeyID(uint160S("c0ffee")); | const CTxDestination dst = CKeyID(uint160S("c0ffee")); | ||||
const CTxDestination invalidDst = CNoDestination{}; | const CTxDestination invalidDst = CNoDestination{}; | ||||
for (auto net : GetNetworks()) { | for (auto net : GetNetworks()) { | ||||
for (auto otherNet : GetNetworks()) { | for (auto otherNet : GetNetworks()) { | ||||
if (net == otherNet) continue; | if (net == otherNet) { | ||||
continue; | |||||
} | |||||
const auto netParams = CreateChainParams(net); | const auto netParams = CreateChainParams(net); | ||||
std::string encoded = EncodeCashAddr(dst, *netParams); | std::string encoded = EncodeCashAddr(dst, *netParams); | ||||
const auto otherNetParams = CreateChainParams(otherNet); | const auto otherNetParams = CreateChainParams(otherNet); | ||||
CTxDestination decoded = DecodeCashAddr(encoded, *otherNetParams); | CTxDestination decoded = DecodeCashAddr(encoded, *otherNetParams); | ||||
BOOST_CHECK(decoded != dst); | BOOST_CHECK(decoded != dst); | ||||
BOOST_CHECK(decoded == invalidDst); | BOOST_CHECK(decoded == invalidDst); | ||||
▲ Show 20 Lines • Show All 322 Lines • Show Last 20 Lines |