mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 06:49:38 -04:00
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 ind6a5dc4a2e
when these RPC methods were first introduced. They could have been dropped whendca923150e
refactored these methods to use waitTipChanged(), which already checks for shutdown. Making this change now simplifies the next commit.
This commit is contained in:
parent
f9cf8bd0ab
commit
a3bf43343f
1 changed files with 3 additions and 5 deletions
|
@ -287,9 +287,7 @@ static RPCHelpMan waitfornewblock()
|
|||
Mining& miner = EnsureMining(node);
|
||||
|
||||
auto block{CHECK_NONFATAL(miner.getTip()).value()};
|
||||
if (IsRPCRunning()) {
|
||||
block = timeout ? miner.waitTipChanged(block.hash, std::chrono::milliseconds(timeout)) : miner.waitTipChanged(block.hash);
|
||||
}
|
||||
block = timeout ? miner.waitTipChanged(block.hash, std::chrono::milliseconds(timeout)) : miner.waitTipChanged(block.hash);
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.pushKV("hash", block.hash.GetHex());
|
||||
|
@ -334,7 +332,7 @@ static RPCHelpMan waitforblock()
|
|||
|
||||
auto block{CHECK_NONFATAL(miner.getTip()).value()};
|
||||
const auto deadline{std::chrono::steady_clock::now() + 1ms * timeout};
|
||||
while (IsRPCRunning() && block.hash != hash) {
|
||||
while (block.hash != hash) {
|
||||
if (timeout) {
|
||||
auto now{std::chrono::steady_clock::now()};
|
||||
if (now >= deadline) break;
|
||||
|
@ -390,7 +388,7 @@ static RPCHelpMan waitforblockheight()
|
|||
auto block{CHECK_NONFATAL(miner.getTip()).value()};
|
||||
const auto deadline{std::chrono::steady_clock::now() + 1ms * timeout};
|
||||
|
||||
while (IsRPCRunning() && block.height < height) {
|
||||
while (block.height < height) {
|
||||
if (timeout) {
|
||||
auto now{std::chrono::steady_clock::now()};
|
||||
if (now >= deadline) break;
|
||||
|
|
Loading…
Add table
Reference in a new issue