mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
rpc: call IsInitialBlockDownload via miner interface
This commit is contained in:
parent
dda0b0834f
commit
a9716c53f0
3 changed files with 9 additions and 1 deletions
|
@ -30,6 +30,9 @@ public:
|
||||||
//! If this chain is exclusively used for testing
|
//! If this chain is exclusively used for testing
|
||||||
virtual bool isTestChain() = 0;
|
virtual bool isTestChain() = 0;
|
||||||
|
|
||||||
|
//! Returns whether IBD is still in progress.
|
||||||
|
virtual bool isInitialBlockDownload() = 0;
|
||||||
|
|
||||||
//! Returns the hash for the tip of this chain
|
//! Returns the hash for the tip of this chain
|
||||||
virtual std::optional<uint256> getTipHash() = 0;
|
virtual std::optional<uint256> getTipHash() = 0;
|
||||||
|
|
||||||
|
|
|
@ -847,6 +847,11 @@ public:
|
||||||
return chainman().GetParams().IsTestChain();
|
return chainman().GetParams().IsTestChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isInitialBlockDownload() override
|
||||||
|
{
|
||||||
|
return chainman().IsInitialBlockDownload();
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<uint256> getTipHash() override
|
std::optional<uint256> getTipHash() override
|
||||||
{
|
{
|
||||||
LOCK(::cs_main);
|
LOCK(::cs_main);
|
||||||
|
|
|
@ -735,7 +735,7 @@ static RPCHelpMan getblocktemplate()
|
||||||
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!");
|
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chainman.IsInitialBlockDownload()) {
|
if (miner.isInitialBlockDownload()) {
|
||||||
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks...");
|
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue