Skip to content

Commit b60be6b

Browse files
committed
Clean up RPCs that are disabled in safe-mode.
This removes some inconsistencies in what worked and didn't work in safemode. Now only RPCs involved in getting balances or sending funds are disabled. Previously you could mine but not submit blocks— but we may need more blocks to resolve a fork that triggered safe mode in the first place, and the non-submission was not reliable since some miners submit blocks via multiple means. There were also a number of random commands disabled that had nothing to do with the blockchain like verifymessage. Thanks to earlz for pointing out that there were some moderately cheap ways to maliciously trigger safe mode, which brought attention to the fact that safemode wasn't used in a very intelligent way.
1 parent f2286a6 commit b60be6b

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/rpcserver.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ static const CRPCCommand vRPCCommands[] =
232232
{ "getblockchaininfo", &getblockchaininfo, true, false, false },
233233
{ "getbestblockhash", &getbestblockhash, true, false, false },
234234
{ "getblockcount", &getblockcount, true, false, false },
235-
{ "getblock", &getblock, false, false, false },
236-
{ "getblockhash", &getblockhash, false, false, false },
235+
{ "getblock", &getblock, true, false, false },
236+
{ "getblockhash", &getblockhash, true, false, false },
237237
{ "getdifficulty", &getdifficulty, true, false, false },
238238
{ "getrawmempool", &getrawmempool, true, false, false },
239239
{ "gettxout", &gettxout, true, false, false },
@@ -245,32 +245,32 @@ static const CRPCCommand vRPCCommands[] =
245245
{ "getmininginfo", &getmininginfo, true, false, false },
246246
{ "getnetworkhashps", &getnetworkhashps, true, false, false },
247247
{ "prioritisetransaction", &prioritisetransaction, true, false, false },
248-
{ "submitblock", &submitblock, false, true, false },
248+
{ "submitblock", &submitblock, true, true, false },
249249

250250
/* Raw transactions */
251-
{ "createrawtransaction", &createrawtransaction, false, false, false },
252-
{ "decoderawtransaction", &decoderawtransaction, false, false, false },
253-
{ "decodescript", &decodescript, false, false, false },
254-
{ "getrawtransaction", &getrawtransaction, false, false, false },
251+
{ "createrawtransaction", &createrawtransaction, true, false, false },
252+
{ "decoderawtransaction", &decoderawtransaction, true, false, false },
253+
{ "decodescript", &decodescript, true, false, false },
254+
{ "getrawtransaction", &getrawtransaction, true, false, false },
255255
{ "sendrawtransaction", &sendrawtransaction, false, false, false },
256256
{ "signrawtransaction", &signrawtransaction, false, false, false }, /* uses wallet if enabled */
257257

258258
/* Utility functions */
259259
{ "createmultisig", &createmultisig, true, true , false },
260260
{ "validateaddress", &validateaddress, true, false, false }, /* uses wallet if enabled */
261-
{ "verifymessage", &verifymessage, false, false, false },
261+
{ "verifymessage", &verifymessage, true, false, false },
262262
{ "estimatefee", &estimatefee, true, true, false },
263263
{ "estimatepriority", &estimatepriority, true, true, false },
264264

265265
#ifdef ENABLE_WALLET
266266
/* Wallet */
267-
{ "addmultisigaddress", &addmultisigaddress, false, false, true },
267+
{ "addmultisigaddress", &addmultisigaddress, true, false, true },
268268
{ "backupwallet", &backupwallet, true, false, true },
269269
{ "dumpprivkey", &dumpprivkey, true, false, true },
270270
{ "dumpwallet", &dumpwallet, true, false, true },
271-
{ "encryptwallet", &encryptwallet, false, false, true },
271+
{ "encryptwallet", &encryptwallet, true, false, true },
272272
{ "getaccountaddress", &getaccountaddress, true, false, true },
273-
{ "getaccount", &getaccount, false, false, true },
273+
{ "getaccount", &getaccount, true, false, true },
274274
{ "getaddressesbyaccount", &getaddressesbyaccount, true, false, true },
275275
{ "getbalance", &getbalance, false, false, true },
276276
{ "getnewaddress", &getnewaddress, true, false, true },
@@ -279,10 +279,10 @@ static const CRPCCommand vRPCCommands[] =
279279
{ "getreceivedbyaddress", &getreceivedbyaddress, false, false, true },
280280
{ "gettransaction", &gettransaction, false, false, true },
281281
{ "getunconfirmedbalance", &getunconfirmedbalance, false, false, true },
282-
{ "getwalletinfo", &getwalletinfo, true, false, true },
283-
{ "importprivkey", &importprivkey, false, false, true },
284-
{ "importwallet", &importwallet, false, false, true },
285-
{ "importaddress", &importaddress, false, false, true },
282+
{ "getwalletinfo", &getwalletinfo, false, false, true },
283+
{ "importprivkey", &importprivkey, true, false, true },
284+
{ "importwallet", &importwallet, true, false, true },
285+
{ "importaddress", &importaddress, true, false, true },
286286
{ "keypoolrefill", &keypoolrefill, true, false, true },
287287
{ "listaccounts", &listaccounts, false, false, true },
288288
{ "listaddressgroupings", &listaddressgroupings, false, false, true },
@@ -292,16 +292,16 @@ static const CRPCCommand vRPCCommands[] =
292292
{ "listsinceblock", &listsinceblock, false, false, true },
293293
{ "listtransactions", &listtransactions, false, false, true },
294294
{ "listunspent", &listunspent, false, false, true },
295-
{ "lockunspent", &lockunspent, false, false, true },
295+
{ "lockunspent", &lockunspent, true, false, true },
296296
{ "move", &movecmd, false, false, true },
297297
{ "sendfrom", &sendfrom, false, false, true },
298298
{ "sendmany", &sendmany, false, false, true },
299299
{ "sendtoaddress", &sendtoaddress, false, false, true },
300300
{ "setaccount", &setaccount, true, false, true },
301-
{ "settxfee", &settxfee, false, false, true },
302-
{ "signmessage", &signmessage, false, false, true },
301+
{ "settxfee", &settxfee, true, false, true },
302+
{ "signmessage", &signmessage, true, false, true },
303303
{ "walletlock", &walletlock, true, false, true },
304-
{ "walletpassphrasechange", &walletpassphrasechange, false, false, true },
304+
{ "walletpassphrasechange", &walletpassphrasechange, true, false, true },
305305
{ "walletpassphrase", &walletpassphrase, true, false, true },
306306

307307
/* Wallet-enabled mining */

0 commit comments

Comments
 (0)