Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/protocol.h
Show All 37 Lines | enum RPCErrorCode { | ||||
RPC_METHOD_NOT_FOUND = -32601, | RPC_METHOD_NOT_FOUND = -32601, | ||||
RPC_INVALID_PARAMS = -32602, | RPC_INVALID_PARAMS = -32602, | ||||
// RPC_INTERNAL_ERROR should only be used for genuine errors in bitcoind | // RPC_INTERNAL_ERROR should only be used for genuine errors in bitcoind | ||||
// (for example datadir corruption). | // (for example datadir corruption). | ||||
RPC_INTERNAL_ERROR = -32603, | RPC_INTERNAL_ERROR = -32603, | ||||
RPC_PARSE_ERROR = -32700, | RPC_PARSE_ERROR = -32700, | ||||
//! General application defined errors | //! General application defined errors | ||||
//!< std::exception thrown in command handling | //! std::exception thrown in command handling | ||||
RPC_MISC_ERROR = -1, | RPC_MISC_ERROR = -1, | ||||
//!< Unexpected type was passed as parameter | //! Unexpected type was passed as parameter | ||||
RPC_TYPE_ERROR = -3, | RPC_TYPE_ERROR = -3, | ||||
//!< Invalid address or key | //! Invalid address or key | ||||
RPC_INVALID_ADDRESS_OR_KEY = -5, | RPC_INVALID_ADDRESS_OR_KEY = -5, | ||||
//!< Ran out of memory during operation | //! Ran out of memory during operation | ||||
RPC_OUT_OF_MEMORY = -7, | RPC_OUT_OF_MEMORY = -7, | ||||
//!< Invalid, missing or duplicate parameter | //! Invalid, missing or duplicate parameter | ||||
RPC_INVALID_PARAMETER = -8, | RPC_INVALID_PARAMETER = -8, | ||||
//!< Database error | //! Database error | ||||
RPC_DATABASE_ERROR = -20, | RPC_DATABASE_ERROR = -20, | ||||
//!< Error parsing or validating structure in raw format | //! Error parsing or validating structure in raw format | ||||
RPC_DESERIALIZATION_ERROR = -22, | RPC_DESERIALIZATION_ERROR = -22, | ||||
//!< General error during transaction or block submission | //! General error during transaction or block submission | ||||
RPC_VERIFY_ERROR = -25, | RPC_VERIFY_ERROR = -25, | ||||
//!< Transaction or block was rejected by network rules | //! Transaction or block was rejected by network rules | ||||
RPC_VERIFY_REJECTED = -26, | RPC_VERIFY_REJECTED = -26, | ||||
//!< Transaction already in chain | //! Transaction already in chain | ||||
RPC_VERIFY_ALREADY_IN_CHAIN = -27, | RPC_VERIFY_ALREADY_IN_CHAIN = -27, | ||||
//!< Client still warming up | //! Client still warming up | ||||
RPC_IN_WARMUP = -28, | RPC_IN_WARMUP = -28, | ||||
//!< RPC method is deprecated | //! RPC method is deprecated | ||||
RPC_METHOD_DEPRECATED = -32, | RPC_METHOD_DEPRECATED = -32, | ||||
//! Aliases for backward compatibility | //! Aliases for backward compatibility | ||||
RPC_TRANSACTION_ERROR = RPC_VERIFY_ERROR, | RPC_TRANSACTION_ERROR = RPC_VERIFY_ERROR, | ||||
RPC_TRANSACTION_REJECTED = RPC_VERIFY_REJECTED, | RPC_TRANSACTION_REJECTED = RPC_VERIFY_REJECTED, | ||||
RPC_TRANSACTION_ALREADY_IN_CHAIN = RPC_VERIFY_ALREADY_IN_CHAIN, | RPC_TRANSACTION_ALREADY_IN_CHAIN = RPC_VERIFY_ALREADY_IN_CHAIN, | ||||
//! P2P client errors | //! P2P client errors | ||||
//!< Bitcoin is not connected | //! Bitcoin is not connected | ||||
RPC_CLIENT_NOT_CONNECTED = -9, | RPC_CLIENT_NOT_CONNECTED = -9, | ||||
//!< Still downloading initial blocks | //! Still downloading initial blocks | ||||
RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, | RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, | ||||
//!< Node is already added | //! Node is already added | ||||
RPC_CLIENT_NODE_ALREADY_ADDED = -23, | RPC_CLIENT_NODE_ALREADY_ADDED = -23, | ||||
//!< Node has not been added before | //! Node has not been added before | ||||
RPC_CLIENT_NODE_NOT_ADDED = -24, | RPC_CLIENT_NODE_NOT_ADDED = -24, | ||||
//!< Node to disconnect not found in connected nodes | //! Node to disconnect not found in connected nodes | ||||
RPC_CLIENT_NODE_NOT_CONNECTED = -29, | RPC_CLIENT_NODE_NOT_CONNECTED = -29, | ||||
//!< Invalid IP/Subnet | //! Invalid IP/Subnet | ||||
RPC_CLIENT_INVALID_IP_OR_SUBNET = -30, | RPC_CLIENT_INVALID_IP_OR_SUBNET = -30, | ||||
//!< No valid connection manager instance found | //! No valid connection manager instance found | ||||
RPC_CLIENT_P2P_DISABLED = -31, | RPC_CLIENT_P2P_DISABLED = -31, | ||||
//! Wallet errors | //! Wallet errors | ||||
//!< Unspecified problem with wallet (key not found etc.) | //! Unspecified problem with wallet (key not found etc.) | ||||
RPC_WALLET_ERROR = -4, | RPC_WALLET_ERROR = -4, | ||||
//!< Not enough funds in wallet or account | //! Not enough funds in wallet or account | ||||
RPC_WALLET_INSUFFICIENT_FUNDS = -6, | RPC_WALLET_INSUFFICIENT_FUNDS = -6, | ||||
//!< Invalid label name | //! Invalid label name | ||||
RPC_WALLET_INVALID_LABEL_NAME = -11, | RPC_WALLET_INVALID_LABEL_NAME = -11, | ||||
//!< Keypool ran out, call keypoolrefill first | //! Keypool ran out, call keypoolrefill first | ||||
RPC_WALLET_KEYPOOL_RAN_OUT = -12, | RPC_WALLET_KEYPOOL_RAN_OUT = -12, | ||||
//!< Enter the wallet passphrase with walletpassphrase first | //! Enter the wallet passphrase with walletpassphrase first | ||||
RPC_WALLET_UNLOCK_NEEDED = -13, | RPC_WALLET_UNLOCK_NEEDED = -13, | ||||
//!< The wallet passphrase entered was incorrect | //! The wallet passphrase entered was incorrect | ||||
RPC_WALLET_PASSPHRASE_INCORRECT = -14, | RPC_WALLET_PASSPHRASE_INCORRECT = -14, | ||||
//!< Command given in wrong wallet encryption state (encrypting an encrypted | //! Command given in wrong wallet encryption state (encrypting an encrypted | ||||
//! wallet etc.) | //! wallet etc.) | ||||
RPC_WALLET_WRONG_ENC_STATE = -15, | RPC_WALLET_WRONG_ENC_STATE = -15, | ||||
//!< Failed to encrypt the wallet | //! Failed to encrypt the wallet | ||||
RPC_WALLET_ENCRYPTION_FAILED = -16, | RPC_WALLET_ENCRYPTION_FAILED = -16, | ||||
//!< Wallet is already unlocked | //! Wallet is already unlocked | ||||
RPC_WALLET_ALREADY_UNLOCKED = -17, | RPC_WALLET_ALREADY_UNLOCKED = -17, | ||||
//!< Invalid wallet specified | //! Invalid wallet specified | ||||
RPC_WALLET_NOT_FOUND = -18, | RPC_WALLET_NOT_FOUND = -18, | ||||
//!< No wallet specified (error when there are multiple wallets loaded) | //! No wallet specified (error when there are multiple wallets loaded) | ||||
RPC_WALLET_NOT_SPECIFIED = -19, | RPC_WALLET_NOT_SPECIFIED = -19, | ||||
//!< Backwards compatible aliases | //! Backwards compatible aliases | ||||
RPC_WALLET_INVALID_ACCOUNT_NAME = RPC_WALLET_INVALID_LABEL_NAME, | RPC_WALLET_INVALID_ACCOUNT_NAME = RPC_WALLET_INVALID_LABEL_NAME, | ||||
//! Unused reserved codes, kept around for backwards compatibility. Do not | //! Unused reserved codes, kept around for backwards compatibility. Do not | ||||
//! reuse. | //! reuse. | ||||
//!< Server is in safe mode, and command is not allowed in safe mode | //! Server is in safe mode, and command is not allowed in safe mode | ||||
RPC_FORBIDDEN_BY_SAFE_MODE = -2, | RPC_FORBIDDEN_BY_SAFE_MODE = -2, | ||||
}; | }; | ||||
UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue ¶ms, | UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue ¶ms, | ||||
const UniValue &id); | const UniValue &id); | ||||
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, | UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, | ||||
const UniValue &id); | const UniValue &id); | ||||
std::string JSONRPCReply(const UniValue &result, const UniValue &error, | std::string JSONRPCReply(const UniValue &result, const UniValue &error, | ||||
Show All 13 Lines |