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

@@ -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));
}
/**