From 376c0c6dae2bebbb3e1352377e71fb1996d09f64 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Sun, 14 Nov 2021 08:44:40 +1000 Subject: [PATCH] rpc: getdeploymentinfo: include block hash/height --- src/rpc/blockchain.cpp | 4 ++++ test/functional/rpc_blockchain.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index dc5c91fe8ab..32cb65679e6 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1611,6 +1611,8 @@ static RPCHelpMan getdeploymentinfo() }, RPCResult{ RPCResult::Type::OBJ, "", "", { + {RPCResult::Type::STR, "hash", "requested block hash (or tip)"}, + {RPCResult::Type::NUM, "height", "requested block height (or tip)"}, {RPCResult::Type::OBJ, "deployments", "", { {RPCResult::Type::OBJ, "xxxx", "name of the deployment", RPCHelpForDeployment} }}, @@ -1638,6 +1640,8 @@ static RPCHelpMan getdeploymentinfo() const Consensus::Params& consensusParams = Params().GetConsensus(); UniValue deploymentinfo(UniValue::VOBJ); + deploymentinfo.pushKV("hash", tip->GetBlockHash().ToString()); + deploymentinfo.pushKV("height", tip->nHeight); deploymentinfo.pushKV("deployments", DeploymentInfo(tip, consensusParams)); return deploymentinfo; }, diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index 2498543bbe3..0e560abc491 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -177,6 +177,8 @@ class BlockchainTest(BitcoinTestFramework): assert height >= 144 and height <= 287 assert_equal(gdi_result, { + "hash": blockhash, + "height": height, "deployments": { 'bip34': {'type': 'buried', 'active': True, 'height': 2}, 'bip66': {'type': 'buried', 'active': True, 'height': 3},