aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Todd <pete@petertodd.org>2015-11-13 15:35:04 -0500
committerPeter Todd <pete@petertodd.org>2015-11-13 15:35:04 -0500
commit748321eb5ba709feed716a3ccd0624a27767119f (patch)
tree380a915c7225a5e3cc25b7bde340fd9f25fdc1b3 /src
parentdbd2c135ddb96bdc3a4e870c2371cb1fac227135 (diff)
downloadbitcoin-748321eb5ba709feed716a3ccd0624a27767119f.tar.xz
Add mediantime field to getblockchaininfo RPC call
Useful now that BIP113 is enforced for transactions entering the mempool. Was previously only (indirectly) available by calling getblocktemplate, a relatively expensive RPC call.
Diffstat (limited to 'src')
-rw-r--r--src/rpcblockchain.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index 9c0e78f772..bc86e181c4 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -639,6 +639,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1));
obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
+ obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast()));
obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip())));
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
obj.push_back(Pair("pruned", fPruneMode));