MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SighashFromStr

Function SighashFromStr

src/core_io.cpp:264–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264util::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
283UniValue ValueFromAmount(const CAmount amount)
284{

Callers 1

ParseSighashStringFunction · 0.85

Calls 3

UntranslatedFunction · 0.85
findMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected