| 59 | } |
| 60 | |
| 61 | std::string UseHInsteadOfApostrophe(const std::string& desc) |
| 62 | { |
| 63 | std::string ret = desc; |
| 64 | while (true) { |
| 65 | auto it = ret.find('\''); |
| 66 | if (it == std::string::npos) break; |
| 67 | ret[it] = 'h'; |
| 68 | } |
| 69 | |
| 70 | // GetDescriptorChecksum returns "" if the checksum exists but is bad. |
| 71 | // Switching apostrophes with 'h' breaks the checksum if it exists - recalculate it and replace the broken one. |
| 72 | if (GetDescriptorChecksum(ret) == "") { |
| 73 | ret = ret.substr(0, desc.size() - 9); |
| 74 | ret += std::string("#") + GetDescriptorChecksum(ret); |
| 75 | } |
| 76 | return ret; |
| 77 | } |
| 78 | |
| 79 | // Count the number of times the string "xpub" appears in a descriptor string |
| 80 | static size_t CountXpubs(const std::string& desc) |
no test coverage detected