diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -326,7 +326,7 @@ // Message from normal bitcoincash:URI // (bitcoincash:123...?message=example) newTx->vOrderForm.push_back( - make_pair("Message", rcp.message.toStdString())); + std::make_pair("Message", rcp.message.toStdString())); } } diff --git a/src/rest.cpp b/src/rest.cpp --- a/src/rest.cpp +++ b/src/rest.cpp @@ -628,12 +628,10 @@ // pack in some essentials // use more or less the same output as mentioned in Bip64 - objGetUTXOResponse.push_back( - Pair("chainHeight", chainActive.Height())); + objGetUTXOResponse.pushKV("chainHeight", chainActive.Height()); objGetUTXOResponse.push_back(Pair( "chaintipHash", chainActive.Tip()->GetBlockHash().GetHex())); - objGetUTXOResponse.push_back( - Pair("bitmap", bitmapStringRepresentation)); + objGetUTXOResponse.pushKV("bitmap", bitmapStringRepresentation); UniValue utxos(UniValue::VARR); for (const CCoin &coin : outs) { diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -78,12 +78,10 @@ result.pushKV("confirmations", confirmations); result.pushKV("height", blockindex->nHeight); result.pushKV("version", blockindex->nVersion); - result.push_back( - Pair("versionHex", strprintf("%08x", blockindex->nVersion))); + result.pushKV("versionHex", strprintf("%08x", blockindex->nVersion)); result.pushKV("merkleroot", blockindex->hashMerkleRoot.GetHex()); result.pushKV("time", int64_t(blockindex->nTime)); - result.push_back( - Pair("mediantime", int64_t(blockindex->GetMedianTimePast()))); + result.pushKV("mediantime", int64_t(blockindex->GetMedianTimePast())); result.pushKV("nonce", uint64_t(blockindex->nNonce)); result.pushKV("bits", strprintf("%08x", blockindex->nBits)); result.pushKV("difficulty", GetDifficulty(blockindex)); @@ -128,8 +126,7 @@ } result.pushKV("tx", txs); result.pushKV("time", block.GetBlockTime()); - result.push_back( - Pair("mediantime", int64_t(blockindex->GetMedianTimePast()))); + result.pushKV("mediantime", int64_t(blockindex->GetMedianTimePast())); result.pushKV("nonce", uint64_t(block.nNonce)); result.pushKV("bits", strprintf("%08x", block.nBits)); result.pushKV("difficulty", GetDifficulty(blockindex)); @@ -407,12 +404,10 @@ info.pushKV("time", e.GetTime()); info.pushKV("height", (int)e.GetHeight()); info.pushKV("startingpriority", e.GetPriority(e.GetHeight())); - info.push_back( - Pair("currentpriority", e.GetPriority(chainActive.Height()))); + info.pushKV("currentpriority", e.GetPriority(chainActive.Height())); info.pushKV("descendantcount", e.GetCountWithDescendants()); info.pushKV("descendantsize", e.GetSizeWithDescendants()); - info.push_back( - Pair("descendantfees", e.GetModFeesWithDescendants() / SATOSHI)); + info.pushKV("descendantfees", e.GetModFeesWithDescendants() / SATOSHI); info.pushKV("ancestorcount", e.GetCountWithAncestors()); info.pushKV("ancestorsize", e.GetSizeWithAncestors()); info.pushKV("ancestorfees", e.GetModFeesWithAncestors() / SATOSHI); @@ -1040,8 +1035,7 @@ ret.pushKV("bogosize", int64_t(stats.nBogoSize)); ret.pushKV("hash_serialized", stats.hashSerialized.GetHex()); ret.pushKV("disk_size", stats.nDiskSize); - ret.push_back( - Pair("total_amount", ValueFromAmount(stats.nTotalAmount))); + ret.pushKV("total_amount", ValueFromAmount(stats.nTotalAmount)); } else { throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to read UTXO set"); } @@ -1201,8 +1195,7 @@ UniValue rv(UniValue::VOBJ); rv.pushKV("id", name); rv.pushKV("version", version); - rv.push_back( - Pair("reject", SoftForkMajorityDesc(version, pindex, consensusParams))); + rv.pushKV("reject", SoftForkMajorityDesc(version, pindex, consensusParams)); return rv; } @@ -1257,13 +1250,10 @@ UniValue obj(UniValue::VOBJ); obj.pushKV("chain", config.GetChainParams().NetworkIDString()); obj.pushKV("blocks", int(chainActive.Height())); - obj.push_back( - Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1)); - obj.push_back( - Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex())); + obj.pushKV("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1); + obj.pushKV("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()); obj.pushKV("difficulty", double(GetDifficulty(chainActive.Tip()))); - obj.push_back( - Pair("mediantime", int64_t(chainActive.Tip()->GetMedianTimePast()))); + obj.pushKV("mediantime", int64_t(chainActive.Tip()->GetMedianTimePast())); obj.push_back( Pair("verificationprogress", GuessVerificationProgress(config.GetChainParams().TxData(), diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -641,8 +641,7 @@ } UniValue aux(UniValue::VOBJ); - aux.push_back( - Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end()))); + aux.pushKV("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())); arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits); @@ -665,13 +664,11 @@ chainActive.Tip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast))); result.pushKV("target", hashTarget.GetHex()); - result.push_back( - Pair("mintime", int64_t(pindexPrev->GetMedianTimePast()) + 1)); + result.pushKV("mintime", int64_t(pindexPrev->GetMedianTimePast()) + 1); result.pushKV("mutable", aMutable); result.pushKV("noncerange", "00000000ffffffff"); // FIXME: Allow for mining block greater than 1M. - result.push_back( - Pair("sigoplimit", GetMaxBlockSigOpsCount(DEFAULT_MAX_BLOCK_SIZE))); + result.pushKV("sigoplimit", GetMaxBlockSigOpsCount(DEFAULT_MAX_BLOCK_SIZE)); result.pushKV("sizelimit", DEFAULT_MAX_BLOCK_SIZE); result.pushKV("curtime", pblock->GetBlockTime()); result.pushKV("bits", strprintf("%08x", pblock->nBits)); diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -167,8 +167,7 @@ int nRequired; ExtractDestinations(subscript, whichType, addresses, nRequired); obj.pushKV("script", GetTxnOutputType(whichType)); - obj.push_back( - Pair("hex", HexStr(subscript.begin(), subscript.end()))); + obj.pushKV("hex", HexStr(subscript.begin(), subscript.end())); UniValue a(UniValue::VARR); for (const CTxDestination &addr : addresses) { a.push_back(EncodeDestination(addr)); @@ -252,8 +251,7 @@ #ifdef ENABLE_WALLET isminetype mine = pwallet ? IsMine(*pwallet, dest) : ISMINE_NO; ret.pushKV("ismine", (mine & ISMINE_SPENDABLE) ? true : false); - ret.push_back( - Pair("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true : false)); + ret.pushKV("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true : false); UniValue detail = boost::apply_visitor(DescribeAddressVisitor(pwallet), dest); ret.pushKVs(detail); diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -409,8 +409,7 @@ if (info.fConnected) { UniValue address(UniValue::VOBJ); address.pushKV("address", info.resolvedAddress.ToString()); - address.push_back( - Pair("connected", info.fInbound ? "inbound" : "outbound")); + address.pushKV("connected", info.fInbound ? "inbound" : "outbound"); addresses.push_back(address); } obj.pushKV("addresses", addresses); @@ -467,17 +466,16 @@ obj.pushKV("timemillis", GetTimeMillis()); UniValue outboundLimit(UniValue::VOBJ); - outboundLimit.push_back( - Pair("timeframe", g_connman->GetMaxOutboundTimeframe())); + outboundLimit.pushKV("timeframe", g_connman->GetMaxOutboundTimeframe()); outboundLimit.pushKV("target", g_connman->GetMaxOutboundTarget()); - outboundLimit.push_back( - Pair("target_reached", g_connman->OutboundTargetReached(false))); + outboundLimit.pushKV("target_reached", + g_connman->OutboundTargetReached(false)); outboundLimit.push_back(Pair("serve_historical_blocks", !g_connman->OutboundTargetReached(true))); - outboundLimit.push_back( - Pair("bytes_left_in_cycle", g_connman->GetOutboundTargetBytesLeft())); - outboundLimit.push_back( - Pair("time_left_in_cycle", g_connman->GetMaxOutboundTimeLeftInCycle())); + outboundLimit.pushKV("bytes_left_in_cycle", + g_connman->GetOutboundTargetBytesLeft()); + outboundLimit.pushKV("time_left_in_cycle", + g_connman->GetMaxOutboundTimeLeftInCycle()); obj.pushKV("uploadtarget", outboundLimit); return obj; } @@ -498,8 +496,7 @@ obj.push_back(Pair("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string())); - obj.push_back( - Pair("proxy_randomize_credentials", proxy.randomize_credentials)); + obj.pushKV("proxy_randomize_credentials", proxy.randomize_credentials); networks.push_back(obj); } return networks; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -44,8 +44,7 @@ out.pushKV("asm", ScriptToAsmStr(scriptPubKey)); if (fIncludeHex) { - out.push_back( - Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); + out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())); } if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -115,8 +115,7 @@ if (confirms > 0) { entry.pushKV("blockhash", wtx.hashBlock.GetHex()); entry.pushKV("blockindex", wtx.nIndex); - entry.push_back( - Pair("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime())); + entry.pushKV("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime()); } else { entry.pushKV("trusted", wtx.IsTrusted()); } @@ -1694,8 +1693,8 @@ entry.pushKV("category", "send"); entry.pushKV("amount", ValueFromAmount(-s.amount)); if (pwallet->mapAddressBook.count(s.destination)) { - entry.push_back( - Pair("label", pwallet->mapAddressBook[s.destination].name)); + entry.pushKV("label", + pwallet->mapAddressBook[s.destination].name); } entry.pushKV("vout", s.vout); entry.pushKV("fee", ValueFromAmount(-1 * nFee)); @@ -2046,8 +2045,8 @@ UniValue ret(UniValue::VOBJ); for (const std::pair &accountBalance : mapAccountBalances) { - ret.push_back( - Pair(accountBalance.first, ValueFromAmount(accountBalance.second))); + ret.pushKV(accountBalance.first, + ValueFromAmount(accountBalance.second)); } return ret; } @@ -3280,8 +3279,7 @@ entry.pushKV("address", EncodeDestination(address)); if (pwallet->mapAddressBook.count(address)) { - entry.push_back( - Pair("account", pwallet->mapAddressBook[address].name)); + entry.pushKV("account", pwallet->mapAddressBook[address].name); } if (scriptPubKey.IsPayToScriptHash()) { @@ -3297,8 +3295,7 @@ entry.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); - entry.push_back( - Pair("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue))); + entry.pushKV("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue)); entry.pushKV("confirmations", out.nDepth); entry.pushKV("spendable", out.fSpendable); entry.pushKV("solvable", out.fSolvable);