MCPcopy Create free account
hub / github.com/citp/BlockSci / SetString

Method SetString

src/scripts/bitcoin_base58.cpp:168–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 7

DecodeBase58CheckFunction · 0.85
InvalidAddressExceptionFunction · 0.85
sizeMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
resizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected