@@ -75,6 +75,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
75
75
result.push_back (Pair (" confirmations" , confirmations));
76
76
result.push_back (Pair (" height" , blockindex->nHeight ));
77
77
result.push_back (Pair (" version" , blockindex->nVersion ));
78
+ result.push_back (Pair (" versionHex" , strprintf (" %08x" , blockindex->nVersion )));
78
79
result.push_back (Pair (" merkleroot" , blockindex->hashMerkleRoot .GetHex ()));
79
80
result.push_back (Pair (" time" , (int64_t )blockindex->nTime ));
80
81
result.push_back (Pair (" mediantime" , (int64_t )blockindex->GetMedianTimePast ()));
@@ -103,6 +104,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
103
104
result.push_back (Pair (" size" , (int )::GetSerializeSize (block, SER_NETWORK, PROTOCOL_VERSION)));
104
105
result.push_back (Pair (" height" , blockindex->nHeight ));
105
106
result.push_back (Pair (" version" , block.nVersion ));
107
+ result.push_back (Pair (" versionHex" , strprintf (" %08x" , block.nVersion )));
106
108
result.push_back (Pair (" merkleroot" , block.hashMerkleRoot .GetHex ()));
107
109
UniValue txs (UniValue::VARR);
108
110
BOOST_FOREACH (const CTransaction&tx, block.vtx )
@@ -353,6 +355,7 @@ UniValue getblockheader(const UniValue& params, bool fHelp)
353
355
" \" confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n "
354
356
" \" height\" : n, (numeric) The block height or index\n "
355
357
" \" version\" : n, (numeric) The block version\n "
358
+ " \" versionHex\" : \" 00000000\" , (string) The block version formatted in hexadecimal\n "
356
359
" \" merkleroot\" : \" xxxx\" , (string) The merkle root\n "
357
360
" \" time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n "
358
361
" \" mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n "
@@ -501,6 +504,7 @@ UniValue getblock(const UniValue& params, bool fHelp)
501
504
" \" size\" : n, (numeric) The block size\n "
502
505
" \" height\" : n, (numeric) The block height or index\n "
503
506
" \" version\" : n, (numeric) The block version\n "
507
+ " \" versionHex\" : \" 00000000\" , (string) The block version formatted in hexadecimal\n "
504
508
" \" merkleroot\" : \" xxxx\" , (string) The merkle root\n "
505
509
" \" tx\" : [ (array of string) The transaction ids\n "
506
510
" \" transactionid\" (string) The transaction id\n "
@@ -801,13 +805,20 @@ static UniValue BIP9SoftForkDesc(const std::string& name, const Consensus::Param
801
805
{
802
806
UniValue rv (UniValue::VOBJ);
803
807
rv.push_back (Pair (" id" , name));
804
- switch (VersionBitsTipState (consensusParams, id)) {
808
+ const ThresholdState thresholdState = VersionBitsTipState (consensusParams, id);
809
+ switch (thresholdState) {
805
810
case THRESHOLD_DEFINED: rv.push_back (Pair (" status" , " defined" )); break ;
806
811
case THRESHOLD_STARTED: rv.push_back (Pair (" status" , " started" )); break ;
807
812
case THRESHOLD_LOCKED_IN: rv.push_back (Pair (" status" , " locked_in" )); break ;
808
813
case THRESHOLD_ACTIVE: rv.push_back (Pair (" status" , " active" )); break ;
809
814
case THRESHOLD_FAILED: rv.push_back (Pair (" status" , " failed" )); break ;
810
815
}
816
+ if (THRESHOLD_STARTED == thresholdState)
817
+ {
818
+ rv.push_back (Pair (" bit" , consensusParams.vDeployments [id].bit ));
819
+ }
820
+ rv.push_back (Pair (" startTime" , consensusParams.vDeployments [id].nStartTime ));
821
+ rv.push_back (Pair (" timeout" , consensusParams.vDeployments [id].nTimeout ));
811
822
return rv;
812
823
}
813
824
@@ -846,6 +857,9 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
846
857
" {\n "
847
858
" \" id\" : \" xxxx\" , (string) name of the softfork\n "
848
859
" \" status\" : \" xxxx\" , (string) one of \" defined\" , \" started\" , \" lockedin\" , \" active\" , \" failed\"\n "
860
+ " \" bit\" : xx, (numeric) the bit, 0-28, in the block version field used to signal this soft fork\n "
861
+ " \" startTime\" : xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n "
862
+ " \" timeout\" : xx (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n "
849
863
" }\n "
850
864
" ]\n "
851
865
" }\n "
0 commit comments