diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2024-05-13 20:20:10 +0000 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2024-05-20 16:48:19 +0000 |
commit | d7707d9843b03f20d2a8c5a45d7b3db58e169e6f (patch) | |
tree | 30b3b88003c41ef7521e1b2e7bbb6add06892505 /src/wallet/rpc/coins.cpp | |
parent | ecd23656db174adef61d3bd753d02698c3528192 (diff) | |
download | bitcoin-d7707d9843b03f20d2a8c5a45d7b3db58e169e6f.tar.xz |
rpc: avoid copying into UniValue
These are simple (and hopefully obviously correct) copies that can be moves
instead.
Diffstat (limited to 'src/wallet/rpc/coins.cpp')
-rw-r--r-- | src/wallet/rpc/coins.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp index b6c7396f4b..2cf94a5722 100644 --- a/src/wallet/rpc/coins.cpp +++ b/src/wallet/rpc/coins.cpp @@ -416,7 +416,7 @@ RPCHelpMan listlockunspent() o.pushKV("txid", outpt.hash.GetHex()); o.pushKV("vout", (int)outpt.n); - ret.push_back(o); + ret.push_back(std::move(o)); } return ret; @@ -477,7 +477,7 @@ RPCHelpMan getbalances() const auto full_bal = GetBalance(wallet, 0, false); balances_mine.pushKV("used", ValueFromAmount(full_bal.m_mine_trusted + full_bal.m_mine_untrusted_pending - bal.m_mine_trusted - bal.m_mine_untrusted_pending)); } - balances.pushKV("mine", balances_mine); + balances.pushKV("mine", std::move(balances_mine)); } auto spk_man = wallet.GetLegacyScriptPubKeyMan(); if (spk_man && spk_man->HaveWatchOnly()) { @@ -485,7 +485,7 @@ RPCHelpMan getbalances() balances_watchonly.pushKV("trusted", ValueFromAmount(bal.m_watchonly_trusted)); balances_watchonly.pushKV("untrusted_pending", ValueFromAmount(bal.m_watchonly_untrusted_pending)); balances_watchonly.pushKV("immature", ValueFromAmount(bal.m_watchonly_immature)); - balances.pushKV("watchonly", balances_watchonly); + balances.pushKV("watchonly", std::move(balances_watchonly)); } AppendLastProcessedBlock(balances, wallet); @@ -724,7 +724,7 @@ RPCHelpMan listunspent() PushParentDescriptors(*pwallet, scriptPubKey, entry); if (avoid_reuse) entry.pushKV("reused", reused); entry.pushKV("safe", out.safe); - results.push_back(entry); + results.push_back(std::move(entry)); } return results; |