mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
scripted-diff: Use UniValue.pushKV instead of push_back(Pair())
-BEGIN VERIFY SCRIPT- git grep -l "push_back(Pair" | xargs sed -i "s/push_back(Pair(\(.*\)));/pushKV(\1);/g" -END VERIFY SCRIPT-
This commit is contained in:
14
src/rest.cpp
14
src/rest.cpp
@@ -540,23 +540,23 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
||||
|
||||
// pack in some essentials
|
||||
// use more or less the same output as mentioned in Bip64
|
||||
objGetUTXOResponse.push_back(Pair("chainHeight", chainActive.Height()));
|
||||
objGetUTXOResponse.push_back(Pair("chaintipHash", chainActive.Tip()->GetBlockHash().GetHex()));
|
||||
objGetUTXOResponse.push_back(Pair("bitmap", bitmapStringRepresentation));
|
||||
objGetUTXOResponse.pushKV("chainHeight", chainActive.Height());
|
||||
objGetUTXOResponse.pushKV("chaintipHash", chainActive.Tip()->GetBlockHash().GetHex());
|
||||
objGetUTXOResponse.pushKV("bitmap", bitmapStringRepresentation);
|
||||
|
||||
UniValue utxos(UniValue::VARR);
|
||||
for (const CCoin& coin : outs) {
|
||||
UniValue utxo(UniValue::VOBJ);
|
||||
utxo.push_back(Pair("height", (int32_t)coin.nHeight));
|
||||
utxo.push_back(Pair("value", ValueFromAmount(coin.out.nValue)));
|
||||
utxo.pushKV("height", (int32_t)coin.nHeight);
|
||||
utxo.pushKV("value", ValueFromAmount(coin.out.nValue));
|
||||
|
||||
// include the script in a json output
|
||||
UniValue o(UniValue::VOBJ);
|
||||
ScriptPubKeyToUniv(coin.out.scriptPubKey, o, true);
|
||||
utxo.push_back(Pair("scriptPubKey", o));
|
||||
utxo.pushKV("scriptPubKey", o);
|
||||
utxos.push_back(utxo);
|
||||
}
|
||||
objGetUTXOResponse.push_back(Pair("utxos", utxos));
|
||||
objGetUTXOResponse.pushKV("utxos", utxos);
|
||||
|
||||
// return json string
|
||||
std::string strJSON = objGetUTXOResponse.write() + "\n";
|
||||
|
||||
Reference in New Issue
Block a user