-
Notifications
You must be signed in to change notification settings - Fork 38.7k
refactor: Make node_id a const& in RemoveBlockRequest #31282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,87 @@ | ||
| // Copyright (c) 2009-2010 Satoshi Nakamoto | ||
| // Copyright (c) 2009-2022 The Bitcoin Core developers | ||
| // Copyright (c) 2009-present The Bitcoin Core developers | ||
| // Distributed under the MIT software license, see the accompanying | ||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| #include <net_processing.h> | ||
|
|
||
| #include <addrman.h> | ||
| #include <arith_uint256.h> | ||
| #include <banman.h> | ||
| #include <blockencodings.h> | ||
| #include <blockfilter.h> | ||
| #include <chain.h> | ||
| #include <chainparams.h> | ||
| #include <common/bloom.h> | ||
| #include <consensus/amount.h> | ||
| #include <consensus/params.h> | ||
| #include <consensus/validation.h> | ||
| #include <core_memusage.h> | ||
| #include <crypto/siphash.h> | ||
| #include <deploymentstatus.h> | ||
| #include <hash.h> | ||
| #include <flatfile.h> | ||
| #include <headerssync.h> | ||
| #include <index/blockfilterindex.h> | ||
| #include <kernel/chain.h> | ||
| #include <kernel/mempool_entry.h> | ||
| #include <logging.h> | ||
| #include <merkleblock.h> | ||
| #include <net.h> | ||
| #include <net_permissions.h> | ||
| #include <netaddress.h> | ||
| #include <netbase.h> | ||
| #include <netmessagemaker.h> | ||
| #include <node/blockstorage.h> | ||
| #include <node/connection_types.h> | ||
| #include <node/protocol_version.h> | ||
| #include <node/timeoffsets.h> | ||
| #include <node/txdownloadman.h> | ||
| #include <node/txreconciliation.h> | ||
| #include <node/warnings.h> | ||
| #include <policy/feerate.h> | ||
| #include <policy/fees.h> | ||
| #include <policy/packages.h> | ||
| #include <policy/policy.h> | ||
| #include <policy/settings.h> | ||
| #include <primitives/block.h> | ||
| #include <primitives/transaction.h> | ||
| #include <protocol.h> | ||
| #include <random.h> | ||
| #include <scheduler.h> | ||
| #include <script/script.h> | ||
| #include <serialize.h> | ||
| #include <span.h> | ||
| #include <streams.h> | ||
| #include <sync.h> | ||
| #include <tinyformat.h> | ||
| #include <txmempool.h> | ||
| #include <txorphanage.h> | ||
| #include <txrequest.h> | ||
| #include <uint256.h> | ||
| #include <util/check.h> | ||
| #include <util/strencodings.h> | ||
| #include <util/time.h> | ||
| #include <util/trace.h> | ||
| #include <validation.h> | ||
|
|
||
| #include <algorithm> | ||
| #include <array> | ||
| #include <atomic> | ||
| #include <compare> | ||
| #include <cstddef> | ||
| #include <deque> | ||
| #include <exception> | ||
| #include <functional> | ||
| #include <future> | ||
| #include <initializer_list> | ||
| #include <iterator> | ||
| #include <limits> | ||
| #include <list> | ||
| #include <map> | ||
| #include <memory> | ||
| #include <optional> | ||
| #include <queue> | ||
| #include <ranges> | ||
| #include <ratio> | ||
| #include <set> | ||
| #include <span> | ||
| #include <typeinfo> | ||
| #include <utility> | ||
|
|
||
|
|
@@ -1155,7 +1185,7 @@ void PeerManagerImpl::RemoveBlockRequest(const uint256& hash, std::optional<Node | |
| Assume(mapBlocksInFlight.count(hash) <= MAX_CMPCTBLOCKS_INFLIGHT_PER_BLOCK); | ||
|
|
||
| while (range.first != range.second) { | ||
| auto [node_id, list_it] = range.first->second; | ||
| const auto& [node_id, list_it]{range.first->second}; | ||
|
||
|
|
||
| if (from_peer && *from_peer != node_id) { | ||
| range.first++; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keep using clang for this job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires adding a suppression, or some other workaround at some point, see #29635 (comment)
Given that GCC does not require suppressions, it may be preferable for now.
Though, I am happy to drop the commit, and leave it for a follow-up. I just thought, it would be nice to include here, so that testing is easy for those that want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmh, I was more concerned about losing the sanitizer, but I guess there is nothing really gained by having it turned on when running valgrind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only benefit would be the symbolizer, but that's not really needed with valgrind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "ci: Use G++ in valgrind tasks" (fa21f83)
I think it would be helpful if this commit message give some hint about why this change is being made. Currently no reason is given and even looking at this PR and understanding a little bit about the bug and trying to read discussion at #29635 (comment) I don't think I get it. If "Currently, valgrind is not usable on a default build with GCC" according to the PR and requires a workaround, why would we switch CI from clang to GCC? That seems like it would just require more workarounds in the future? I'm not questioning the approach and am fine with this change, I just think it would be good to have more explanation of it somewhere, ideally in the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the point is that we want valgrind to be running on builds that are as close as possible to what we release? Since we use gcc for release builds, we would want to have this CI use gcc as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing this message and not updating the commit message before merge. There are several reasons, for example: