mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-04 06:12:07 +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:
@@ -297,7 +297,7 @@ public:
|
||||
total += counts.at(i);
|
||||
}
|
||||
addresses.pushKV("total", total);
|
||||
result.pushKV("addresses_known", addresses);
|
||||
result.pushKV("addresses_known", std::move(addresses));
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, /*id=*/1, JSONRPCVersion::V1_LEGACY);
|
||||
}
|
||||
};
|
||||
@@ -348,7 +348,7 @@ public:
|
||||
connections.pushKV("in", batch[ID_NETWORKINFO]["result"]["connections_in"]);
|
||||
connections.pushKV("out", batch[ID_NETWORKINFO]["result"]["connections_out"]);
|
||||
connections.pushKV("total", batch[ID_NETWORKINFO]["result"]["connections"]);
|
||||
result.pushKV("connections", connections);
|
||||
result.pushKV("connections", std::move(connections));
|
||||
|
||||
result.pushKV("networks", batch[ID_NETWORKINFO]["result"]["networks"]);
|
||||
result.pushKV("difficulty", batch[ID_BLOCKCHAININFO]["result"]["difficulty"]);
|
||||
@@ -940,7 +940,7 @@ static void GetWalletBalances(UniValue& result)
|
||||
const UniValue& balance = getbalances.find_value("result")["mine"]["trusted"];
|
||||
balances.pushKV(wallet_name, balance);
|
||||
}
|
||||
result.pushKV("balances", balances);
|
||||
result.pushKV("balances", std::move(balances));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user