Skip to content

Commit 748321e

Browse files
committed
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.
1 parent dbd2c13 commit 748321e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/rpcblockchain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
639639
obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1));
640640
obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()));
641641
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
642+
obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast()));
642643
obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip())));
643644
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
644645
obj.push_back(Pair("pruned", fPruneMode));

0 commit comments

Comments
 (0)