mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
rpc/blockchain: a constant craving
This commit is contained in:
parent
5179656ef8
commit
fbab43f169
1 changed files with 3 additions and 3 deletions
|
@ -1669,16 +1669,16 @@ static RPCHelpMan getdeploymentinfo()
|
||||||
RPCExamples{ HelpExampleCli("getdeploymentinfo", "") + HelpExampleRpc("getdeploymentinfo", "") },
|
RPCExamples{ HelpExampleCli("getdeploymentinfo", "") + HelpExampleRpc("getdeploymentinfo", "") },
|
||||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||||
{
|
{
|
||||||
ChainstateManager& chainman = EnsureAnyChainman(request.context);
|
const ChainstateManager& chainman = EnsureAnyChainman(request.context);
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
CChainState& active_chainstate = chainman.ActiveChainstate();
|
const CChainState& active_chainstate = chainman.ActiveChainstate();
|
||||||
|
|
||||||
const CBlockIndex* tip;
|
const CBlockIndex* tip;
|
||||||
if (request.params[0].isNull()) {
|
if (request.params[0].isNull()) {
|
||||||
tip = active_chainstate.m_chain.Tip();
|
tip = active_chainstate.m_chain.Tip();
|
||||||
CHECK_NONFATAL(tip);
|
CHECK_NONFATAL(tip);
|
||||||
} else {
|
} else {
|
||||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
const uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||||
tip = chainman.m_blockman.LookupBlockIndex(hash);
|
tip = chainman.m_blockman.LookupBlockIndex(hash);
|
||||||
if (!tip) {
|
if (!tip) {
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
||||||
|
|
Loading…
Add table
Reference in a new issue