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

Function ParseHashV

src/rpc/util.cpp:117–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117uint256 ParseHashV(const UniValue& v, std::string_view name)
118{
119 const std::string& strHex(v.get_str());
120 if (auto rv{uint256::FromHex(strHex)}) return *rv;
121 if (auto expected_len{uint256::size() * 2}; strHex.length() != expected_len) {
122 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be of length %d (not %d, for '%s')", name, expected_len, strHex.length(), strHex));
123 }
124 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be hexadecimal string (not '%s')", name, strHex));
125}
126uint256 ParseHashO(const UniValue& o, std::string_view strKey)
127{
128 return ParseHashV(o.find_value(strKey), strKey);

Callers 15

removeprunedfundsFunction · 0.85
bumpfee_helperFunction · 0.85
listsinceblockFunction · 0.85
gettransactionFunction · 0.85
abandontransactionFunction · 0.85
parse_univalue.cppFile · 0.85
gettxoutproofFunction · 0.85
prioritisetransactionFunction · 0.85
getblocktemplateFunction · 0.85
abortprivatebroadcastFunction · 0.85
getmempoolancestorsFunction · 0.85
getmempooldescendantsFunction · 0.85

Calls 3

FromHexFunction · 0.85
sizeFunction · 0.85
JSONRPCErrorFunction · 0.85

Tested by

no test coverage detected