aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-09-04 15:36:09 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-09-04 15:50:08 +0200
commit5c24d3b98cb7bb0474e14eda8452356b4573879d (patch)
tree6c2d5fa50efe839a947650466e0bf721776c64b8 /src/rpc
parentbdfeb5dfa8d8c9dc178af05881d33c66d171391e (diff)
parentf34c8c466a0e514edac2e8683127b4176ad5d321 (diff)
downloadbitcoin-5c24d3b98cb7bb0474e14eda8452356b4573879d.tar.xz
Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
f34c8c466a0e514edac2e8683127b4176ad5d321 Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift) Pull request description: Make objects in range declarations immutable by default. Rationale: * Immutable objects are easier to reason about. * Prevents accidental or hard-to-notice change of value. Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp2
-rw-r--r--src/rpc/mining.cpp2
-rw-r--r--src/rpc/net.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index f0d767bbfc..165c278ae7 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -426,7 +426,7 @@ static void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) EXCLUSIVE_LOCK
UniValue spent(UniValue::VARR);
const CTxMemPool::txiter &it = mempool.mapTx.find(tx.GetHash());
const CTxMemPool::setEntries &setChildren = mempool.GetMemPoolChildren(it);
- for (const CTxMemPool::txiter &childiter : setChildren) {
+ for (CTxMemPool::txiter childiter : setChildren) {
spent.push_back(childiter->GetTx().GetHash().ToString());
}
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index 9cc4e77768..621b86eec8 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -922,7 +922,7 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
UniValue result(UniValue::VOBJ);
- for (FeeEstimateHorizon horizon : {FeeEstimateHorizon::SHORT_HALFLIFE, FeeEstimateHorizon::MED_HALFLIFE, FeeEstimateHorizon::LONG_HALFLIFE}) {
+ for (const FeeEstimateHorizon horizon : {FeeEstimateHorizon::SHORT_HALFLIFE, FeeEstimateHorizon::MED_HALFLIFE, FeeEstimateHorizon::LONG_HALFLIFE}) {
CFeeRate feeRate;
EstimationResult buckets;
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 343b7d3b05..169a452659 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -164,7 +164,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
obj.pushKV("synced_headers", statestats.nSyncHeight);
obj.pushKV("synced_blocks", statestats.nCommonHeight);
UniValue heights(UniValue::VARR);
- for (int height : statestats.vHeightInFlight) {
+ for (const int height : statestats.vHeightInFlight) {
heights.push_back(height);
}
obj.pushKV("inflight", heights);