Skip to content

refactor: Make node_id a const& in RemoveBlockRequest

Currently, valgrind is not usable on a default build with GCC. Specifically, p2p_compactblocks.py --valgrind gives a false-positive in RemoveBlockRequest when comparing node_id with from_peer. According to the upstream bug report, this happens because both symbols are on the stack and the compiler can more aggressively optimize the compare (order). See https://bugs.kde.org/show_bug.cgi?id=472329#c7

It is possible to work around this bug by pulling at least one value from the stack. For example, by making from_peer a const reference. Alternatively, by replacing auto [node_id, list_it] with const auto& [node_id, list_it], which is done here.

I think this workaround is acceptable, because it does not look like valgrind can trivially fix this. The alternative would be to add a (temporary?) suppression.

Fixes https://github.com/bitcoin/bitcoin/issues/27741

Also, fix iwyu includes, while touching this module.

Also, switch the CI valgrind scripts to use G++.

Merge request reports

Loading