Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/util.cpp
// Copyright (c) 2017 The Bitcoin Core developers | // Copyright (c) 2017 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <key_io.h> | #include <key_io.h> | ||||
#include <keystore.h> | #include <keystore.h> | ||||
#include <pubkey.h> | #include <pubkey.h> | ||||
#include <rpc/protocol.h> | #include <rpc/protocol.h> | ||||
#include <rpc/util.h> | #include <rpc/util.h> | ||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <boost/variant/static_visitor.hpp> | #include <boost/variant/static_visitor.hpp> | ||||
InitInterfaces *g_rpc_interfaces = nullptr; | |||||
// Converts a hex string to a public key if possible | // Converts a hex string to a public key if possible | ||||
CPubKey HexToPubKey(const std::string &hex_in) { | CPubKey HexToPubKey(const std::string &hex_in) { | ||||
if (!IsHex(hex_in)) { | if (!IsHex(hex_in)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Invalid public key: " + hex_in); | "Invalid public key: " + hex_in); | ||||
} | } | ||||
CPubKey vchPubKey(ParseHex(hex_in)); | CPubKey vchPubKey(ParseHex(hex_in)); | ||||
if (!vchPubKey.IsFullyValid()) { | if (!vchPubKey.IsFullyValid()) { | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |