| 262 | } |
| 263 | |
| 264 | util::Result<int> SighashFromStr(const std::string& sighash) |
| 265 | { |
| 266 | static const std::map<std::string, int> map_sighash_values = { |
| 267 | {std::string("DEFAULT"), int(SIGHASH_DEFAULT)}, |
| 268 | {std::string("ALL"), int(SIGHASH_ALL)}, |
| 269 | {std::string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)}, |
| 270 | {std::string("NONE"), int(SIGHASH_NONE)}, |
| 271 | {std::string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)}, |
| 272 | {std::string("SINGLE"), int(SIGHASH_SINGLE)}, |
| 273 | {std::string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)}, |
| 274 | }; |
| 275 | const auto& it = map_sighash_values.find(sighash); |
| 276 | if (it != map_sighash_values.end()) { |
| 277 | return it->second; |
| 278 | } else { |
| 279 | return util::Error{Untranslated("'" + sighash + "' is not a valid sighash parameter.")}; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | UniValue ValueFromAmount(const CAmount amount) |
| 284 | { |
no test coverage detected