mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
rpc: avoid copying into UniValue
These are simple (and hopefully obviously correct) copies that can be moves instead.
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user