@@ -227,6 +227,9 @@ UniValue help(const JSONRPCRequest& jsonRequest)
227
227
UniValue stop (const JSONRPCRequest& jsonRequest)
228
228
{
229
229
// Accept the deprecated and ignored 'detach' boolean argument
230
+ // Also accept the hidden 'wait' integer argument (milliseconds)
231
+ // For instance, 'stop 1000' makes the call wait 1 second before returning
232
+ // to the client (intended for testing)
230
233
if (jsonRequest.fHelp || jsonRequest.params .size () > 1 )
231
234
throw std::runtime_error (
232
235
RPCHelpMan{" stop" ,
@@ -235,6 +238,9 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
235
238
// Event loop will exit after current HTTP requests have been handled, so
236
239
// this reply will get back to the client.
237
240
StartShutdown ();
241
+ if (jsonRequest.params [0 ].isNum ()) {
242
+ MilliSleep (jsonRequest.params [0 ].get_int ());
243
+ }
238
244
return " Bitcoin server stopping" ;
239
245
}
240
246
@@ -264,7 +270,7 @@ static const CRPCCommand vRPCCommands[] =
264
270
// --------------------- ------------------------ ----------------------- ----------
265
271
/* Overall control/query calls */
266
272
{ " control" , " help" , &help, {" command" } },
267
- { " control" , " stop" , &stop, {} },
273
+ { " control" , " stop" , &stop, {" wait " } },
268
274
{ " control" , " uptime" , &uptime, {} },
269
275
};
270
276
// clang-format on
0 commit comments