* Parses the start:end key pair. Possible values are: start start:end start:+offset :end :+offset */
| 160 | :+offset |
| 161 | */ |
| 162 | bool parseKeyspace(const std::string &s, secp256k1::uint256 &start, secp256k1::uint256 &end) |
| 163 | { |
| 164 | size_t pos = s.find(':'); |
| 165 | |
| 166 | if(pos == std::string::npos) { |
| 167 | start = secp256k1::uint256(s); |
| 168 | end = secp256k1::N - 1; |
| 169 | } else { |
| 170 | std::string left = s.substr(0, pos); |
| 171 | |
| 172 | if(left.length() == 0) { |
| 173 | start = secp256k1::uint256(1); |
| 174 | } else { |
| 175 | start = secp256k1::uint256(left); |
| 176 | } |
| 177 | |
| 178 | std::string right = s.substr(pos + 1); |
| 179 | |
| 180 | if(right[0] == '+') { |
| 181 | end = start + secp256k1::uint256(right.substr(1)); |
| 182 | } else { |
| 183 | end = secp256k1::uint256(right); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | return true; |
| 188 | } |
| 189 | |
| 190 | void usage() |
| 191 | { |