aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-02-03 11:45:52 +0800
committerfanquake <fanquake@gmail.com>2020-02-03 12:02:23 +0800
commit365c83e6a8399913cec5f0383978c28f8418fa3b (patch)
treeda6ca9526222e76280b80650e4443ee72a77019e
parent6d0e532ae029cb687258f8cdd43d7f9f3cfaa900 (diff)
parent9a299a59cc8a9ab516e047356c5bc0e93774b557 (diff)
Merge #18054: net: reference instead of copy in BlockConnected range loop
9a299a59cc8a9ab516e047356c5bc0e93774b557 net: reference instead of copy in BlockConnected range loop (Jon Atack) Pull request description: Reference elements in range for loop instead of copying them and fix Clang `-Wrange-loop-analysis` warning introduced in a029e18 ``` net_processing.cpp:1185:25: warning: loop variable 'ptx' of type 'const std::shared_ptr<const CTransaction>' creates a copy from type 'const std::shared_ptr<const CTransaction>' [-Wrange-loop-analysis] for (const auto ptx : pblock->vtx) { ^ net_processing.cpp:1185:14: note: use reference type 'const std::shared_ptr<const CTransaction> &' to prevent copying for (const auto ptx : pblock->vtx) { ^~~~~~~~~~~~~~~~ 1 warning generated. ``` ACKs for top commit: Empact: ACK https://github.com/bitcoin/bitcoin/pull/18054/commits/9a299a59cc8a9ab516e047356c5bc0e93774b557 MarcoFalke: ACK 9a299a59cc8a9ab516e047356c5bc0e93774b557 promag: ACK 9a299a59cc8a9ab516e047356c5bc0e93774b557. elichai: ACK 9a299a59cc8a9ab516e047356c5bc0e93774b557 emilengler: ACK 9a299a5. Tree-SHA512: 9284d1b00684877505454a05071212758c8cea083534e2eec09bfc8a9c3059eea811d2008f6a5a678539444f0d5b3134db1bd23da6514b3d3a1440634c8b53be
-rw-r--r--src/net_processing.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 81deaea0df..cf4aee0647 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1182,7 +1182,7 @@ void PeerLogicValidation::BlockConnected(const std::shared_ptr<const CBlock>& pb
}
{
LOCK(g_cs_recent_confirmed_transactions);
- for (const auto ptx : pblock->vtx) {
+ for (const auto& ptx : pblock->vtx) {
g_recent_confirmed_transactions->insert(ptx->GetHash());
}
}