Browse Source

correction

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@200 1a98c847-1fd6-4fd8-948a-caf3550aa51b
miguelfreitas
s_nakamoto 14 years ago
parent
commit
986b5e257e
  1. 1
      main.cpp
  2. 10
      main.h
  3. 30
      rpc.cpp

1
main.cpp

@ -1953,7 +1953,6 @@ string GetWarnings(string strFor)
{ {
nPriority = alert.nPriority; nPriority = alert.nPriority;
strStatusBar = alert.strStatusBar; strStatusBar = alert.strStatusBar;
strRPC = alert.strRPCError;
} }
} }
} }

10
main.h

@ -1754,7 +1754,7 @@ public:
// Actions // Actions
string strComment; string strComment;
string strStatusBar; string strStatusBar;
string strRPCError; string strReserved;
IMPLEMENT_SERIALIZE IMPLEMENT_SERIALIZE
( (
@ -1772,7 +1772,7 @@ public:
READWRITE(strComment); READWRITE(strComment);
READWRITE(strStatusBar); READWRITE(strStatusBar);
READWRITE(strRPCError); READWRITE(strReserved);
) )
void SetNull() void SetNull()
@ -1790,7 +1790,7 @@ public:
strComment.clear(); strComment.clear();
strStatusBar.clear(); strStatusBar.clear();
strRPCError.clear(); strReserved.clear();
} }
string ToString() const string ToString() const
@ -1815,7 +1815,6 @@ public:
" nPriority = %d\n" " nPriority = %d\n"
" strComment = \"%s\"\n" " strComment = \"%s\"\n"
" strStatusBar = \"%s\"\n" " strStatusBar = \"%s\"\n"
" strRPCError = \"%s\"\n"
")\n", ")\n",
nVersion, nVersion,
nRelayUntil, nRelayUntil,
@ -1828,8 +1827,7 @@ public:
strSetSubVer.c_str(), strSetSubVer.c_str(),
nPriority, nPriority,
strComment.c_str(), strComment.c_str(),
strStatusBar.c_str(), strStatusBar.c_str());
strRPCError.c_str());
} }
void print() const void print() const

30
rpc.cpp

@ -1178,6 +1178,31 @@ pair<string, rpcfn_type> pCallTable[] =
}; };
map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0])); map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0]));
string pAllowInSafeMode[] =
{
"help",
"stop",
"getblockcount",
"getblocknumber",
"getconnectioncount",
"getdifficulty",
"getgenerate",
"setgenerate",
"gethashespersec",
"getinfo",
"getnewaddress",
"getaccountaddress",
"setlabel",
"getaccount",
"getlabel", // deprecated
"getaddressesbyaccount",
"getaddressesbylabel", // deprecated
"backupwallet",
"validateaddress",
"getwork",
};
set<string> setAllowInSafeMode(pAllowInSafeMode, pAllowInSafeMode + sizeof(pAllowInSafeMode)/sizeof(pAllowInSafeMode[0]));
@ -1615,6 +1640,11 @@ void ThreadRPCServer2(void* parg)
if (mi == mapCallTable.end()) if (mi == mapCallTable.end())
throw JSONRPCError(-32601, "Method not found"); throw JSONRPCError(-32601, "Method not found");
// Observe safe mode
string strWarning = GetWarnings("rpc");
if (strWarning != "" && !GetBoolArg("-disablesafemode") && !setAllowInSafeMode.count(strMethod))
throw JSONRPCError(-2, string("Safe mode: ") + strWarning);
try try
{ {
// Execute // Execute

Loading…
Cancel
Save