| 166 | } |
| 167 | |
| 168 | bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes) |
| 169 | { |
| 170 | std::vector<unsigned char> vchTemp; |
| 171 | bool rc58 = DecodeBase58Check(psz, vchTemp); |
| 172 | if ((!rc58) || (vchTemp.size() < nVersionBytes)) { |
| 173 | vchData.clear(); |
| 174 | vchVersion.clear(); |
| 175 | throw InvalidAddressException(); |
| 176 | } |
| 177 | vchVersion.assign(vchTemp.begin(), vchTemp.begin() + nVersionBytes); |
| 178 | vchData.resize(vchTemp.size() - nVersionBytes); |
| 179 | if (!vchData.empty()) |
| 180 | memcpy(vchData.data(), vchTemp.data() + nVersionBytes, vchData.size()); |
| 181 | return true; |
| 182 | } |
| 183 | |
| 184 | bool CBase58Data::SetString(const std::string& str, unsigned int nVersionBytes) |
| 185 | { |
nothing calls this directly
no test coverage detected