BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
protocol.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2018 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_RPC_PROTOCOL_H
7 #define BITCOIN_RPC_PROTOCOL_H
8 
9 #include <fs.h>
10 
11 #include <list>
12 #include <map>
13 #include <stdint.h>
14 #include <string>
15 
16 #include <univalue.h>
17 
20 {
21  HTTP_OK = 200,
29 };
30 
33 {
35  // RPC_INVALID_REQUEST is internally mapped to HTTP_BAD_REQUEST (400).
36  // It should not be used for application-layer errors.
38  // RPC_METHOD_NOT_FOUND is internally mapped to HTTP_NOT_FOUND (404).
39  // It should not be used for application-layer errors.
42  // RPC_INTERNAL_ERROR should only be used for genuine errors in bsha3d
43  // (for example datadir corruption).
45  RPC_PARSE_ERROR = -32700,
46 
58  RPC_IN_WARMUP = -28,
60 
65 
74 
87 
90 
93 };
94 
95 UniValue JSONRPCRequestObj(const std::string& strMethod, const UniValue& params, const UniValue& id);
96 UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
97 std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
98 UniValue JSONRPCError(int code, const std::string& message);
99 
101 bool GenerateAuthCookie(std::string *cookie_out);
103 bool GetAuthCookie(std::string *cookie_out);
105 void DeleteAuthCookie();
107 std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue &in, size_t num);
108 
109 #endif // BITCOIN_RPC_PROTOCOL_H
No wallet specified (error when there are multiple wallets loaded)
Definition: protocol.h:86
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: protocol.cpp:33
Aliases for backward compatibility.
Definition: protocol.h:62
std::string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: protocol.cpp:45
Node has not been added before.
Definition: protocol.h:70
Keypool ran out, call keypoolrefill first.
Definition: protocol.h:79
Ran out of memory during operation.
Definition: protocol.h:51
Enter the wallet passphrase with walletpassphrase first.
Definition: protocol.h:80
bool GenerateAuthCookie(std::string *cookie_out)
Generate a new RPC authentication cookie and write it to disk.
Definition: protocol.cpp:76
Wallet is already unlocked.
Definition: protocol.h:84
Transaction or block was rejected by network rules.
Definition: protocol.h:56
HTTPStatusCode
HTTP status codes.
Definition: protocol.h:19
bool GetAuthCookie(std::string *cookie_out)
Read the RPC authentication cookie from disk.
Definition: protocol.cpp:108
Client still warming up.
Definition: protocol.h:58
Invalid, missing or duplicate parameter.
Definition: protocol.h:52
UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params, const UniValue &id)
JSON-RPC protocol.
Definition: protocol.cpp:24
General error during transaction or block submission.
Definition: protocol.h:55
The wallet passphrase entered was incorrect.
Definition: protocol.h:81
Transaction already in chain.
Definition: protocol.h:57
Unexpected type was passed as parameter.
Definition: protocol.h:49
Command given in wrong wallet encryption state (encrypting an encrypted wallet etc.)
Definition: protocol.h:82
General application defined errors.
Definition: protocol.h:48
Invalid address or key.
Definition: protocol.h:50
Invalid IP/Subnet.
Definition: protocol.h:72
Invalid wallet specified.
Definition: protocol.h:85
Backwards compatible aliases.
Definition: protocol.h:89
RPC method is deprecated.
Definition: protocol.h:59
void DeleteAuthCookie()
Delete RPC authentication cookie from disk.
Definition: protocol.cpp:124
Database error.
Definition: protocol.h:53
Failed to encrypt the wallet.
Definition: protocol.h:83
std::vector< UniValue > JSONRPCProcessBatchReply(const UniValue &in, size_t num)
Parse JSON-RPC batch reply into a vector.
Definition: protocol.cpp:133
Not enough funds in wallet or account.
Definition: protocol.h:77
Node to disconnect not found in connected nodes.
Definition: protocol.h:71
Node is already added.
Definition: protocol.h:69
Unused reserved codes, kept around for backwards compatibility. Do not reuse.
Definition: protocol.h:92
UniValue JSONRPCError(int code, const std::string &message)
Definition: protocol.cpp:51
bool error(const char *fmt, const Args &... args)
Definition: util.h:59
Standard JSON-RPC 2.0 errors.
Definition: protocol.h:37
Wallet errors.
Definition: protocol.h:76
No valid connection manager instance found.
Definition: protocol.h:73
RPCErrorCode
Bitcoin RPC error codes.
Definition: protocol.h:32
Still downloading initial blocks.
Definition: protocol.h:68
P2P client errors.
Definition: protocol.h:67
Invalid label name.
Definition: protocol.h:78
Error parsing or validating structure in raw format.
Definition: protocol.h:54