MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / HexToPubKey

Function HexToPubKey

src/rpc/util.cpp:13–23  ·  view source on GitHub ↗

Converts a hex string to a public key if possible

Source from the content-addressed store, hash-verified

11
12// Converts a hex string to a public key if possible
13CPubKey HexToPubKey(const std::string& hex_in)
14{
15 if (!IsHex(hex_in)) {
16 throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid public key: " + hex_in);
17 }
18 CPubKey vchPubKey(ParseHex(hex_in));
19 if (!vchPubKey.IsFullyValid()) {
20 throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid public key: " + hex_in);
21 }
22 return vchPubKey;
23}
24
25// Retrieves a public key for an address from the given CKeyStore
26CPubKey AddrToPubKey(CKeyStore* const keystore, const std::string& addr_in)

Callers 2

addmultisigaddressFunction · 0.85
createmultisigFunction · 0.85

Calls 4

IsHexFunction · 0.85
JSONRPCErrorFunction · 0.85
ParseHexFunction · 0.85
IsFullyValidMethod · 0.80

Tested by

no test coverage detected