Skip to content

Commit 2ae705d

Browse files
achow101laanwj
authored andcommitted
Remove Safe mode
1 parent eac067a commit 2ae705d

File tree

10 files changed

+2
-83
lines changed

10 files changed

+2
-83
lines changed

src/Makefile.am

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ BITCOIN_CORE_H = \
137137
rpc/client.h \
138138
rpc/mining.h \
139139
rpc/protocol.h \
140-
rpc/safemode.h \
141140
rpc/server.h \
142141
rpc/rawtransaction.h \
143142
rpc/register.h \
@@ -223,7 +222,6 @@ libbitcoin_server_a_SOURCES = \
223222
rpc/misc.cpp \
224223
rpc/net.cpp \
225224
rpc/rawtransaction.cpp \
226-
rpc/safemode.cpp \
227225
rpc/server.cpp \
228226
script/sigcache.cpp \
229227
timedata.cpp \

src/init.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <policy/policy.h>
3232
#include <rpc/server.h>
3333
#include <rpc/register.h>
34-
#include <rpc/safemode.h>
3534
#include <rpc/blockchain.h>
3635
#include <script/standard.h>
3736
#include <script/sigcache.h>
@@ -448,9 +447,7 @@ std::string HelpMessage(HelpMessageMode mode)
448447
strUsage += HelpMessageOpt("-checkblockindex", strprintf("Do a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive and mapBlocksUnlinked occasionally. (default: %u)", defaultChainParams->DefaultConsistencyChecks()));
449448
strUsage += HelpMessageOpt("-checkmempool=<n>", strprintf("Run checks every <n> transactions (default: %u)", defaultChainParams->DefaultConsistencyChecks()));
450449
strUsage += HelpMessageOpt("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", DEFAULT_CHECKPOINTS_ENABLED));
451-
strUsage += HelpMessageOpt("-disablesafemode", strprintf("Disable safemode, override a real safe mode event (default: %u)", DEFAULT_DISABLE_SAFEMODE));
452450
strUsage += HelpMessageOpt("-deprecatedrpc=<method>", "Allows deprecated RPC method(s) to be used");
453-
strUsage += HelpMessageOpt("-testsafemode", strprintf("Force safe mode (default: %u)", DEFAULT_TESTSAFEMODE));
454451
strUsage += HelpMessageOpt("-dropmessagestest=<n>", "Randomly drop 1 of every <n> network messages");
455452
strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", DEFAULT_STOPAFTERBLOCKIMPORT));
456453
strUsage += HelpMessageOpt("-stopatheight", strprintf("Stop running after reaching the given height in the main chain (default: %u)", DEFAULT_STOPATHEIGHT));

src/rpc/rawtransaction.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <policy/rbf.h>
2020
#include <primitives/transaction.h>
2121
#include <rpc/rawtransaction.h>
22-
#include <rpc/safemode.h>
2322
#include <rpc/server.h>
2423
#include <script/script.h>
2524
#include <script/script_error.h>
@@ -1108,8 +1107,6 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
11081107
+ HelpExampleRpc("sendrawtransaction", "\"signedhex\"")
11091108
);
11101109

1111-
ObserveSafeMode();
1112-
11131110
std::promise<void> promise;
11141111

11151112
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL});
@@ -1217,8 +1214,6 @@ UniValue testmempoolaccept(const JSONRPCRequest& request)
12171214
);
12181215
}
12191216

1220-
ObserveSafeMode();
1221-
12221217
RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL});
12231218
if (request.params[0].get_array().size() != 1) {
12241219
throw JSONRPCError(RPC_INVALID_PARAMETER, "Array must contain exactly one raw transaction for now");

src/rpc/safemode.cpp

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/rpc/safemode.h

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/wallet/rpcdump.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <chain.h>
66
#include <key_io.h>
7-
#include <rpc/safemode.h>
87
#include <rpc/server.h>
98
#include <validation.h>
109
#include <script/script.h>
@@ -204,7 +203,6 @@ UniValue abortrescan(const JSONRPCRequest& request)
204203
+ HelpExampleRpc("abortrescan", "")
205204
);
206205

207-
ObserveSafeMode();
208206
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) return false;
209207
pwallet->AbortRescan();
210208
return true;

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <policy/rbf.h>
1818
#include <rpc/mining.h>
1919
#include <rpc/rawtransaction.h>
20-
#include <rpc/safemode.h>
2120
#include <rpc/server.h>
2221
#include <rpc/util.h>
2322
#include <script/sign.h>
@@ -525,8 +524,6 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
525524
+ HelpExampleRpc("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.1, \"donation\", \"seans outpost\"")
526525
);
527526

528-
ObserveSafeMode();
529-
530527
// Make sure the results are valid at least up to the most recent block
531528
// the user could have gotten from another RPC command prior to now
532529
pwallet->BlockUntilSyncedToCurrentChain();
@@ -607,8 +604,6 @@ UniValue listaddressgroupings(const JSONRPCRequest& request)
607604
+ HelpExampleRpc("listaddressgroupings", "")
608605
);
609606

610-
ObserveSafeMode();
611-
612607
// Make sure the results are valid at least up to the most recent block
613608
// the user could have gotten from another RPC command prior to now
614609
pwallet->BlockUntilSyncedToCurrentChain();
@@ -724,8 +719,6 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
724719
+ HelpExampleRpc("getreceivedbyaddress", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", 6")
725720
);
726721

727-
ObserveSafeMode();
728-
729722
// Make sure the results are valid at least up to the most recent block
730723
// the user could have gotten from another RPC command prior to now
731724
pwallet->BlockUntilSyncedToCurrentChain();
@@ -798,8 +791,6 @@ UniValue getreceivedbylabel(const JSONRPCRequest& request)
798791
+ HelpExampleRpc("getreceivedbylabel", "\"tabby\", 6")
799792
);
800793

801-
ObserveSafeMode();
802-
803794
// Make sure the results are valid at least up to the most recent block
804795
// the user could have gotten from another RPC command prior to now
805796
pwallet->BlockUntilSyncedToCurrentChain();
@@ -879,8 +870,6 @@ UniValue getbalance(const JSONRPCRequest& request)
879870
+ HelpExampleRpc("getbalance", "\"*\", 6")
880871
);
881872

882-
ObserveSafeMode();
883-
884873
// Make sure the results are valid at least up to the most recent block
885874
// the user could have gotten from another RPC command prior to now
886875
pwallet->BlockUntilSyncedToCurrentChain();
@@ -933,8 +922,6 @@ UniValue getunconfirmedbalance(const JSONRPCRequest &request)
933922
"getunconfirmedbalance\n"
934923
"Returns the server's total unconfirmed balance\n");
935924

936-
ObserveSafeMode();
937-
938925
// Make sure the results are valid at least up to the most recent block
939926
// the user could have gotten from another RPC command prior to now
940927
pwallet->BlockUntilSyncedToCurrentChain();
@@ -980,7 +967,6 @@ UniValue movecmd(const JSONRPCRequest& request)
980967
+ HelpExampleRpc("move", "\"timotei\", \"akiko\", 0.01, 6, \"happy birthday!\"")
981968
);
982969

983-
ObserveSafeMode();
984970
LOCK2(cs_main, pwallet->cs_wallet);
985971

986972
std::string strFrom = LabelFromValue(request.params[0]);
@@ -1039,8 +1025,6 @@ UniValue sendfrom(const JSONRPCRequest& request)
10391025
+ HelpExampleRpc("sendfrom", "\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.01, 6, \"donation\", \"seans outpost\"")
10401026
);
10411027

1042-
ObserveSafeMode();
1043-
10441028
// Make sure the results are valid at least up to the most recent block
10451029
// the user could have gotten from another RPC command prior to now
10461030
pwallet->BlockUntilSyncedToCurrentChain();
@@ -1170,8 +1154,6 @@ UniValue sendmany(const JSONRPCRequest& request)
11701154

11711155
if (request.fHelp || request.params.size() < 2 || request.params.size() > 8) throw std::runtime_error(help_text);
11721156

1173-
ObserveSafeMode();
1174-
11751157
// Make sure the results are valid at least up to the most recent block
11761158
// the user could have gotten from another RPC command prior to now
11771159
pwallet->BlockUntilSyncedToCurrentChain();
@@ -1683,8 +1665,6 @@ UniValue listreceivedbyaddress(const JSONRPCRequest& request)
16831665
+ HelpExampleRpc("listreceivedbyaddress", "6, true, true, \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\"")
16841666
);
16851667

1686-
ObserveSafeMode();
1687-
16881668
// Make sure the results are valid at least up to the most recent block
16891669
// the user could have gotten from another RPC command prior to now
16901670
pwallet->BlockUntilSyncedToCurrentChain();
@@ -1735,8 +1715,6 @@ UniValue listreceivedbylabel(const JSONRPCRequest& request)
17351715
+ HelpExampleRpc("listreceivedbylabel", "6, true, true")
17361716
);
17371717

1738-
ObserveSafeMode();
1739-
17401718
// Make sure the results are valid at least up to the most recent block
17411719
// the user could have gotten from another RPC command prior to now
17421720
pwallet->BlockUntilSyncedToCurrentChain();
@@ -1974,8 +1952,6 @@ UniValue listtransactions(const JSONRPCRequest& request)
19741952
}
19751953
if (request.fHelp || request.params.size() > 4) throw std::runtime_error(help_text);
19761954

1977-
ObserveSafeMode();
1978-
19791955
// Make sure the results are valid at least up to the most recent block
19801956
// the user could have gotten from another RPC command prior to now
19811957
pwallet->BlockUntilSyncedToCurrentChain();
@@ -2088,8 +2064,6 @@ UniValue listaccounts(const JSONRPCRequest& request)
20882064
+ HelpExampleRpc("listaccounts", "6")
20892065
);
20902066

2091-
ObserveSafeMode();
2092-
20932067
// Make sure the results are valid at least up to the most recent block
20942068
// the user could have gotten from another RPC command prior to now
20952069
pwallet->BlockUntilSyncedToCurrentChain();
@@ -2202,8 +2176,6 @@ UniValue listsinceblock(const JSONRPCRequest& request)
22022176
+ HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6")
22032177
);
22042178

2205-
ObserveSafeMode();
2206-
22072179
// Make sure the results are valid at least up to the most recent block
22082180
// the user could have gotten from another RPC command prior to now
22092181
pwallet->BlockUntilSyncedToCurrentChain();
@@ -2339,8 +2311,6 @@ UniValue gettransaction(const JSONRPCRequest& request)
23392311
+ HelpExampleRpc("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
23402312
);
23412313

2342-
ObserveSafeMode();
2343-
23442314
// Make sure the results are valid at least up to the most recent block
23452315
// the user could have gotten from another RPC command prior to now
23462316
pwallet->BlockUntilSyncedToCurrentChain();
@@ -2407,8 +2377,6 @@ UniValue abandontransaction(const JSONRPCRequest& request)
24072377
);
24082378
}
24092379

2410-
ObserveSafeMode();
2411-
24122380
// Make sure the results are valid at least up to the most recent block
24132381
// the user could have gotten from another RPC command prior to now
24142382
pwallet->BlockUntilSyncedToCurrentChain();
@@ -2889,7 +2857,6 @@ UniValue listlockunspent(const JSONRPCRequest& request)
28892857
+ HelpExampleRpc("listlockunspent", "")
28902858
);
28912859

2892-
ObserveSafeMode();
28932860
LOCK2(cs_main, pwallet->cs_wallet);
28942861

28952862
std::vector<COutPoint> vOutpts;
@@ -2968,8 +2935,6 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
29682935
+ HelpExampleRpc("getwalletinfo", "")
29692936
);
29702937

2971-
ObserveSafeMode();
2972-
29732938
// Make sure the results are valid at least up to the most recent block
29742939
// the user could have gotten from another RPC command prior to now
29752940
pwallet->BlockUntilSyncedToCurrentChain();
@@ -3126,8 +3091,6 @@ UniValue listunspent(const JSONRPCRequest& request)
31263091
+ HelpExampleRpc("listunspent", "6, 9999999, [] , true, { \"minimumAmount\": 0.005 } ")
31273092
);
31283093

3129-
ObserveSafeMode();
3130-
31313094
int nMinDepth = 1;
31323095
if (!request.params[0].isNull()) {
31333096
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
@@ -3300,7 +3263,6 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
33003263
+ HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"")
33013264
);
33023265

3303-
ObserveSafeMode();
33043266
RPCTypeCheck(request.params, {UniValue::VSTR});
33053267

33063268
// Make sure the results are valid at least up to the most recent block

src/warnings.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ std::string GetWarnings(const std::string& strFor)
5151
strGUI = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications");
5252
}
5353

54-
if (gArgs.GetBoolArg("-testsafemode", DEFAULT_TESTSAFEMODE))
55-
strStatusBar = strRPC = strGUI = "testsafemode enabled";
56-
5754
// Misc warnings like out of disk space and clock is wrong
5855
if (strMiscWarning != "")
5956
{

src/warnings.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ void SetfLargeWorkInvalidChainFound(bool flag);
2222
*/
2323
std::string GetWarnings(const std::string& strFor);
2424

25-
static const bool DEFAULT_TESTSAFEMODE = false;
26-
2725
#endif // BITCOIN_WARNINGS_H

test/functional/feature_pruning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def reorg_test(self):
124124
# Reboot node 1 to clear its mempool (hopefully make the invalidate faster)
125125
# Lower the block max size so we don't keep mining all our big mempool transactions (from disconnected blocks)
126126
self.stop_node(1)
127-
self.start_node(1, extra_args=["-maxreceivebuffer=20000","-blockmaxweight=20000", "-checkblocks=5", "-disablesafemode"])
127+
self.start_node(1, extra_args=["-maxreceivebuffer=20000","-blockmaxweight=20000", "-checkblocks=5"])
128128

129129
height = self.nodes[1].getblockcount()
130130
self.log.info("Current block height: %d" % height)
@@ -147,7 +147,7 @@ def reorg_test(self):
147147

148148
# Reboot node1 to clear those giant tx's from mempool
149149
self.stop_node(1)
150-
self.start_node(1, extra_args=["-maxreceivebuffer=20000","-blockmaxweight=20000", "-checkblocks=5", "-disablesafemode"])
150+
self.start_node(1, extra_args=["-maxreceivebuffer=20000","-blockmaxweight=20000", "-checkblocks=5"])
151151

152152
self.log.info("Generating new longer chain of 300 more blocks")
153153
self.nodes[1].generate(300)

0 commit comments

Comments
 (0)