@@ -71,6 +71,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
71
71
result.push_back (Pair (" version" , blockindex->nVersion ));
72
72
result.push_back (Pair (" merkleroot" , blockindex->hashMerkleRoot .GetHex ()));
73
73
result.push_back (Pair (" time" , (int64_t )blockindex->nTime ));
74
+ result.push_back (Pair (" mediantime" , (int64_t )blockindex->GetMedianTimePast ()));
74
75
result.push_back (Pair (" nonce" , (uint64_t )blockindex->nNonce ));
75
76
result.push_back (Pair (" bits" , strprintf (" %08x" , blockindex->nBits )));
76
77
result.push_back (Pair (" difficulty" , GetDifficulty (blockindex)));
@@ -111,6 +112,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
111
112
}
112
113
result.push_back (Pair (" tx" , txs));
113
114
result.push_back (Pair (" time" , block.GetBlockTime ()));
115
+ result.push_back (Pair (" mediantime" , (int64_t )blockindex->GetMedianTimePast ()));
114
116
result.push_back (Pair (" nonce" , (uint64_t )block.nNonce ));
115
117
result.push_back (Pair (" bits" , strprintf (" %08x" , block.nBits )));
116
118
result.push_back (Pair (" difficulty" , GetDifficulty (blockindex)));
@@ -313,6 +315,7 @@ UniValue getblockheader(const UniValue& params, bool fHelp)
313
315
" \" version\" : n, (numeric) The block version\n "
314
316
" \" merkleroot\" : \" xxxx\" , (string) The merkle root\n "
315
317
" \" time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n "
318
+ " \" mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n "
316
319
" \" nonce\" : n, (numeric) The nonce\n "
317
320
" \" bits\" : \" 1d00ffff\" , (string) The bits\n "
318
321
" \" difficulty\" : x.xxx, (numeric) The difficulty\n "
@@ -374,6 +377,7 @@ UniValue getblock(const UniValue& params, bool fHelp)
374
377
" ,...\n "
375
378
" ],\n "
376
379
" \" time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n "
380
+ " \" mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n "
377
381
" \" nonce\" : n, (numeric) The nonce\n "
378
382
" \" bits\" : \" 1d00ffff\" , (string) The bits\n "
379
383
" \" difficulty\" : x.xxx, (numeric) The difficulty\n "
0 commit comments