| 24 | } |
| 25 | |
| 26 | void CAssetsDir::SetHex(const std::string& assetHex, const std::string& label) |
| 27 | { |
| 28 | if (!IsHex(assetHex) || assetHex.size() != 64) |
| 29 | throw std::runtime_error("The asset must be hex string of length 64"); |
| 30 | |
| 31 | const std::vector<std::string> protectedLabels = {"", "*", "bitcoin", "Bitcoin", "btc"}; |
| 32 | for (std::string proLabel : protectedLabels) { |
| 33 | if (label == proLabel) { |
| 34 | throw std::runtime_error(strprintf("'%s' label is protected", proLabel)); |
| 35 | } |
| 36 | } |
| 37 | Set(CAsset(uint256S(assetHex)), AssetMetadata(label)); |
| 38 | } |
| 39 | |
| 40 | void CAssetsDir::InitFromStrings(const std::vector<std::string>& assetsToInit, const std::string& pegged_asset_name) |
| 41 | { |
nothing calls this directly
no test coverage detected