@@ -211,14 +211,14 @@ UniValue getmininginfo(const JSONRPCRequest& request)
211
211
LOCK (cs_main);
212
212
213
213
UniValue obj (UniValue::VOBJ);
214
- obj.push_back ( Pair ( " blocks" , (int )chainActive.Height () ));
215
- obj.push_back ( Pair ( " currentblockweight" , (uint64_t )nLastBlockWeight) );
216
- obj.push_back ( Pair ( " currentblocktx" , (uint64_t )nLastBlockTx) );
217
- obj.push_back ( Pair ( " difficulty" , (double )GetDifficulty () ));
218
- obj.push_back ( Pair ( " networkhashps" , getnetworkhashps (request) ));
219
- obj.push_back ( Pair ( " pooledtx" , (uint64_t )mempool.size () ));
220
- obj.push_back ( Pair ( " chain" , Params ().NetworkIDString () ));
221
- obj.push_back ( Pair ( " warnings" , GetWarnings (" statusbar" ) ));
214
+ obj.pushKV ( " blocks" , (int )chainActive.Height ());
215
+ obj.pushKV ( " currentblockweight" , (uint64_t )nLastBlockWeight);
216
+ obj.pushKV ( " currentblocktx" , (uint64_t )nLastBlockTx);
217
+ obj.pushKV ( " difficulty" , (double )GetDifficulty ());
218
+ obj.pushKV ( " networkhashps" , getnetworkhashps (request));
219
+ obj.pushKV ( " pooledtx" , (uint64_t )mempool.size ());
220
+ obj.pushKV ( " chain" , Params ().NetworkIDString ());
221
+ obj.pushKV ( " warnings" , GetWarnings (" statusbar" ));
222
222
return obj;
223
223
}
224
224
@@ -550,33 +550,33 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
550
550
551
551
UniValue entry (UniValue::VOBJ);
552
552
553
- entry.push_back ( Pair ( " data" , EncodeHexTx (tx) ));
554
- entry.push_back ( Pair ( " txid" , txHash.GetHex () ));
555
- entry.push_back ( Pair ( " hash" , tx.GetWitnessHash ().GetHex () ));
553
+ entry.pushKV ( " data" , EncodeHexTx (tx));
554
+ entry.pushKV ( " txid" , txHash.GetHex ());
555
+ entry.pushKV ( " hash" , tx.GetWitnessHash ().GetHex ());
556
556
557
557
UniValue deps (UniValue::VARR);
558
558
for (const CTxIn &in : tx.vin )
559
559
{
560
560
if (setTxIndex.count (in.prevout .hash ))
561
561
deps.push_back (setTxIndex[in.prevout .hash ]);
562
562
}
563
- entry.push_back ( Pair ( " depends" , deps) );
563
+ entry.pushKV ( " depends" , deps);
564
564
565
565
int index_in_template = i - 1 ;
566
- entry.push_back ( Pair ( " fee" , pblocktemplate->vTxFees [index_in_template]) );
566
+ entry.pushKV ( " fee" , pblocktemplate->vTxFees [index_in_template]);
567
567
int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost [index_in_template];
568
568
if (fPreSegWit ) {
569
569
assert (nTxSigOps % WITNESS_SCALE_FACTOR == 0 );
570
570
nTxSigOps /= WITNESS_SCALE_FACTOR;
571
571
}
572
- entry.push_back ( Pair ( " sigops" , nTxSigOps) );
573
- entry.push_back ( Pair ( " weight" , GetTransactionWeight (tx) ));
572
+ entry.pushKV ( " sigops" , nTxSigOps);
573
+ entry.pushKV ( " weight" , GetTransactionWeight (tx));
574
574
575
575
transactions.push_back (entry);
576
576
}
577
577
578
578
UniValue aux (UniValue::VOBJ);
579
- aux.push_back ( Pair ( " flags" , HexStr (COINBASE_FLAGS.begin (), COINBASE_FLAGS.end () )));
579
+ aux.pushKV ( " flags" , HexStr (COINBASE_FLAGS.begin (), COINBASE_FLAGS.end ()));
580
580
581
581
arith_uint256 hashTarget = arith_uint256 ().SetCompact (pblock->nBits );
582
582
@@ -586,7 +586,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
586
586
aMutable.push_back (" prevblock" );
587
587
588
588
UniValue result (UniValue::VOBJ);
589
- result.push_back ( Pair ( " capabilities" , aCaps) );
589
+ result.pushKV ( " capabilities" , aCaps);
590
590
591
591
UniValue aRules (UniValue::VARR);
592
592
UniValue vbavailable (UniValue::VOBJ);
@@ -605,7 +605,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
605
605
case THRESHOLD_STARTED:
606
606
{
607
607
const struct VBDeploymentInfo & vbinfo = VersionBitsDeploymentInfo[pos];
608
- vbavailable.push_back ( Pair ( gbt_vb_name (pos), consensusParams.vDeployments [pos].bit ) );
608
+ vbavailable.pushKV ( gbt_vb_name (pos), consensusParams.vDeployments [pos].bit );
609
609
if (setClientRules.find (vbinfo.name ) == setClientRules.end ()) {
610
610
if (!vbinfo.gbt_force ) {
611
611
// If the client doesn't support this, don't indicate it in the [default] version
@@ -630,10 +630,10 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
630
630
}
631
631
}
632
632
}
633
- result.push_back ( Pair ( " version" , pblock->nVersion ) );
634
- result.push_back ( Pair ( " rules" , aRules) );
635
- result.push_back ( Pair ( " vbavailable" , vbavailable) );
636
- result.push_back ( Pair ( " vbrequired" , int (0 ) ));
633
+ result.pushKV ( " version" , pblock->nVersion );
634
+ result.pushKV ( " rules" , aRules);
635
+ result.pushKV ( " vbavailable" , vbavailable);
636
+ result.pushKV ( " vbrequired" , int (0 ));
637
637
638
638
if (nMaxVersionPreVB >= 2 ) {
639
639
// If VB is supported by the client, nMaxVersionPreVB is -1, so we won't get here
@@ -643,15 +643,15 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
643
643
aMutable.push_back (" version/force" );
644
644
}
645
645
646
- result.push_back ( Pair ( " previousblockhash" , pblock->hashPrevBlock .GetHex () ));
647
- result.push_back ( Pair ( " transactions" , transactions) );
648
- result.push_back ( Pair ( " coinbaseaux" , aux) );
649
- result.push_back ( Pair ( " coinbasevalue" , (int64_t )pblock->vtx [0 ]->vout [0 ].nValue ) );
650
- result.push_back ( Pair ( " longpollid" , chainActive.Tip ()->GetBlockHash ().GetHex () + i64tostr (nTransactionsUpdatedLast) ));
651
- result.push_back ( Pair ( " target" , hashTarget.GetHex () ));
652
- result.push_back ( Pair ( " mintime" , (int64_t )pindexPrev->GetMedianTimePast ()+1 ) );
653
- result.push_back ( Pair ( " mutable" , aMutable) );
654
- result.push_back ( Pair ( " noncerange" , " 00000000ffffffff" ) );
646
+ result.pushKV ( " previousblockhash" , pblock->hashPrevBlock .GetHex ());
647
+ result.pushKV ( " transactions" , transactions);
648
+ result.pushKV ( " coinbaseaux" , aux);
649
+ result.pushKV ( " coinbasevalue" , (int64_t )pblock->vtx [0 ]->vout [0 ].nValue );
650
+ result.pushKV ( " longpollid" , chainActive.Tip ()->GetBlockHash ().GetHex () + i64tostr (nTransactionsUpdatedLast));
651
+ result.pushKV ( " target" , hashTarget.GetHex ());
652
+ result.pushKV ( " mintime" , (int64_t )pindexPrev->GetMedianTimePast ()+1 );
653
+ result.pushKV ( " mutable" , aMutable);
654
+ result.pushKV ( " noncerange" , " 00000000ffffffff" );
655
655
int64_t nSigOpLimit = MAX_BLOCK_SIGOPS_COST;
656
656
int64_t nSizeLimit = MAX_BLOCK_SERIALIZED_SIZE;
657
657
if (fPreSegWit ) {
@@ -660,17 +660,17 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
660
660
assert (nSizeLimit % WITNESS_SCALE_FACTOR == 0 );
661
661
nSizeLimit /= WITNESS_SCALE_FACTOR;
662
662
}
663
- result.push_back ( Pair ( " sigoplimit" , nSigOpLimit) );
664
- result.push_back ( Pair ( " sizelimit" , nSizeLimit) );
663
+ result.pushKV ( " sigoplimit" , nSigOpLimit);
664
+ result.pushKV ( " sizelimit" , nSizeLimit);
665
665
if (!fPreSegWit ) {
666
- result.push_back ( Pair ( " weightlimit" , (int64_t )MAX_BLOCK_WEIGHT) );
666
+ result.pushKV ( " weightlimit" , (int64_t )MAX_BLOCK_WEIGHT);
667
667
}
668
- result.push_back ( Pair ( " curtime" , pblock->GetBlockTime () ));
669
- result.push_back ( Pair ( " bits" , strprintf (" %08x" , pblock->nBits ) ));
670
- result.push_back ( Pair ( " height" , (int64_t )(pindexPrev->nHeight +1 ) ));
668
+ result.pushKV ( " curtime" , pblock->GetBlockTime ());
669
+ result.pushKV ( " bits" , strprintf (" %08x" , pblock->nBits ));
670
+ result.pushKV ( " height" , (int64_t )(pindexPrev->nHeight +1 ));
671
671
672
672
if (!pblocktemplate->vchCoinbaseCommitment .empty () && fSupportsSegwit ) {
673
- result.push_back ( Pair ( " default_witness_commitment" , HexStr (pblocktemplate->vchCoinbaseCommitment .begin (), pblocktemplate->vchCoinbaseCommitment .end () )));
673
+ result.pushKV ( " default_witness_commitment" , HexStr (pblocktemplate->vchCoinbaseCommitment .begin (), pblocktemplate->vchCoinbaseCommitment .end ()));
674
674
}
675
675
676
676
return result;
@@ -823,12 +823,12 @@ UniValue estimatesmartfee(const JSONRPCRequest& request)
823
823
FeeCalculation feeCalc;
824
824
CFeeRate feeRate = ::feeEstimator.estimateSmartFee (conf_target, &feeCalc, conservative);
825
825
if (feeRate != CFeeRate (0 )) {
826
- result.push_back ( Pair ( " feerate" , ValueFromAmount (feeRate.GetFeePerK () )));
826
+ result.pushKV ( " feerate" , ValueFromAmount (feeRate.GetFeePerK ()));
827
827
} else {
828
828
errors.push_back (" Insufficient data or no feerate found" );
829
- result.push_back ( Pair ( " errors" , errors) );
829
+ result.pushKV ( " errors" , errors);
830
830
}
831
- result.push_back ( Pair ( " blocks" , feeCalc.returnedTarget ) );
831
+ result.pushKV ( " blocks" , feeCalc.returnedTarget );
832
832
return result;
833
833
}
834
834
@@ -899,37 +899,37 @@ UniValue estimaterawfee(const JSONRPCRequest& request)
899
899
UniValue horizon_result (UniValue::VOBJ);
900
900
UniValue errors (UniValue::VARR);
901
901
UniValue passbucket (UniValue::VOBJ);
902
- passbucket.push_back ( Pair ( " startrange" , round (buckets.pass .start ) ));
903
- passbucket.push_back ( Pair ( " endrange" , round (buckets.pass .end ) ));
904
- passbucket.push_back ( Pair ( " withintarget" , round (buckets.pass .withinTarget * 100.0 ) / 100.0 ) );
905
- passbucket.push_back ( Pair ( " totalconfirmed" , round (buckets.pass .totalConfirmed * 100.0 ) / 100.0 ) );
906
- passbucket.push_back ( Pair ( " inmempool" , round (buckets.pass .inMempool * 100.0 ) / 100.0 ) );
907
- passbucket.push_back ( Pair ( " leftmempool" , round (buckets.pass .leftMempool * 100.0 ) / 100.0 ) );
902
+ passbucket.pushKV ( " startrange" , round (buckets.pass .start ));
903
+ passbucket.pushKV ( " endrange" , round (buckets.pass .end ));
904
+ passbucket.pushKV ( " withintarget" , round (buckets.pass .withinTarget * 100.0 ) / 100.0 );
905
+ passbucket.pushKV ( " totalconfirmed" , round (buckets.pass .totalConfirmed * 100.0 ) / 100.0 );
906
+ passbucket.pushKV ( " inmempool" , round (buckets.pass .inMempool * 100.0 ) / 100.0 );
907
+ passbucket.pushKV ( " leftmempool" , round (buckets.pass .leftMempool * 100.0 ) / 100.0 );
908
908
UniValue failbucket (UniValue::VOBJ);
909
- failbucket.push_back ( Pair ( " startrange" , round (buckets.fail .start ) ));
910
- failbucket.push_back ( Pair ( " endrange" , round (buckets.fail .end ) ));
911
- failbucket.push_back ( Pair ( " withintarget" , round (buckets.fail .withinTarget * 100.0 ) / 100.0 ) );
912
- failbucket.push_back ( Pair ( " totalconfirmed" , round (buckets.fail .totalConfirmed * 100.0 ) / 100.0 ) );
913
- failbucket.push_back ( Pair ( " inmempool" , round (buckets.fail .inMempool * 100.0 ) / 100.0 ) );
914
- failbucket.push_back ( Pair ( " leftmempool" , round (buckets.fail .leftMempool * 100.0 ) / 100.0 ) );
909
+ failbucket.pushKV ( " startrange" , round (buckets.fail .start ));
910
+ failbucket.pushKV ( " endrange" , round (buckets.fail .end ));
911
+ failbucket.pushKV ( " withintarget" , round (buckets.fail .withinTarget * 100.0 ) / 100.0 );
912
+ failbucket.pushKV ( " totalconfirmed" , round (buckets.fail .totalConfirmed * 100.0 ) / 100.0 );
913
+ failbucket.pushKV ( " inmempool" , round (buckets.fail .inMempool * 100.0 ) / 100.0 );
914
+ failbucket.pushKV ( " leftmempool" , round (buckets.fail .leftMempool * 100.0 ) / 100.0 );
915
915
916
916
// CFeeRate(0) is used to indicate error as a return value from estimateRawFee
917
917
if (feeRate != CFeeRate (0 )) {
918
- horizon_result.push_back ( Pair ( " feerate" , ValueFromAmount (feeRate.GetFeePerK () )));
919
- horizon_result.push_back ( Pair ( " decay" , buckets.decay ) );
920
- horizon_result.push_back ( Pair ( " scale" , (int )buckets.scale ) );
921
- horizon_result.push_back ( Pair ( " pass" , passbucket) );
918
+ horizon_result.pushKV ( " feerate" , ValueFromAmount (feeRate.GetFeePerK ()));
919
+ horizon_result.pushKV ( " decay" , buckets.decay );
920
+ horizon_result.pushKV ( " scale" , (int )buckets.scale );
921
+ horizon_result.pushKV ( " pass" , passbucket);
922
922
// buckets.fail.start == -1 indicates that all buckets passed, there is no fail bucket to output
923
- if (buckets.fail .start != -1 ) horizon_result.push_back ( Pair ( " fail" , failbucket) );
923
+ if (buckets.fail .start != -1 ) horizon_result.pushKV ( " fail" , failbucket);
924
924
} else {
925
925
// Output only information that is still meaningful in the event of error
926
- horizon_result.push_back ( Pair ( " decay" , buckets.decay ) );
927
- horizon_result.push_back ( Pair ( " scale" , (int )buckets.scale ) );
928
- horizon_result.push_back ( Pair ( " fail" , failbucket) );
926
+ horizon_result.pushKV ( " decay" , buckets.decay );
927
+ horizon_result.pushKV ( " scale" , (int )buckets.scale );
928
+ horizon_result.pushKV ( " fail" , failbucket);
929
929
errors.push_back (" Insufficient data or no feerate found which meets threshold" );
930
- horizon_result.push_back ( Pair ( " errors" ,errors) );
930
+ horizon_result.pushKV ( " errors" ,errors);
931
931
}
932
- result.push_back ( Pair ( StringForFeeEstimateHorizon (horizon), horizon_result) );
932
+ result.pushKV ( StringForFeeEstimateHorizon (horizon), horizon_result);
933
933
}
934
934
return result;
935
935
}
0 commit comments