Skip to content

Commit a3bf433

Browse files
committed
rpc: drop unneeded IsRPCRunning() guards
This was preventing the (hidden) waitfornewblock, waitforblock and waitforblockheight methods from being used in the GUI. The check was added in d6a5dc4 when these RPC methods were first introduced. They could have been dropped when dca9231 refactored these methods to use waitTipChanged(), which already checks for shutdown. Making this change now simplifies the next commit.
1 parent f9cf8bd commit a3bf433

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/rpc/blockchain.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,7 @@ static RPCHelpMan waitfornewblock()
287287
Mining& miner = EnsureMining(node);
288288

289289
auto block{CHECK_NONFATAL(miner.getTip()).value()};
290-
if (IsRPCRunning()) {
291-
block = timeout ? miner.waitTipChanged(block.hash, std::chrono::milliseconds(timeout)) : miner.waitTipChanged(block.hash);
292-
}
290+
block = timeout ? miner.waitTipChanged(block.hash, std::chrono::milliseconds(timeout)) : miner.waitTipChanged(block.hash);
293291

294292
UniValue ret(UniValue::VOBJ);
295293
ret.pushKV("hash", block.hash.GetHex());
@@ -334,7 +332,7 @@ static RPCHelpMan waitforblock()
334332

335333
auto block{CHECK_NONFATAL(miner.getTip()).value()};
336334
const auto deadline{std::chrono::steady_clock::now() + 1ms * timeout};
337-
while (IsRPCRunning() && block.hash != hash) {
335+
while (block.hash != hash) {
338336
if (timeout) {
339337
auto now{std::chrono::steady_clock::now()};
340338
if (now >= deadline) break;
@@ -390,7 +388,7 @@ static RPCHelpMan waitforblockheight()
390388
auto block{CHECK_NONFATAL(miner.getTip()).value()};
391389
const auto deadline{std::chrono::steady_clock::now() + 1ms * timeout};
392390

393-
while (IsRPCRunning() && block.height < height) {
391+
while (block.height < height) {
394392
if (timeout) {
395393
auto now{std::chrono::steady_clock::now()};
396394
if (now >= deadline) break;

0 commit comments

Comments
 (0)