rpc: avoid copying into UniValue

These are simple (and hopefully obviously correct) copies that can be moves
instead.
This commit is contained in:
Cory Fields
2024-05-13 20:20:10 +00:00
parent ecd23656db
commit d7707d9843
27 changed files with 183 additions and 183 deletions

View File

@@ -934,10 +934,10 @@ static bool rest_getutxos(const std::any& context, HTTPRequest* req, const std::
// include the script in a json output
UniValue o(UniValue::VOBJ);
ScriptToUniv(coin.out.scriptPubKey, /*out=*/o, /*include_hex=*/true, /*include_address=*/true);
utxo.pushKV("scriptPubKey", o);
utxos.push_back(utxo);
utxo.pushKV("scriptPubKey", std::move(o));
utxos.push_back(std::move(utxo));
}
objGetUTXOResponse.pushKV("utxos", utxos);
objGetUTXOResponse.pushKV("utxos", std::move(utxos));
// return json string
std::string strJSON = objGetUTXOResponse.write() + "\n";