Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33072. ReviewsSee the guideline for information on the review process. ConflictsNo conflicts as of last run. |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
95f83cd to
76295ef
Compare
|
This doesn't compile, and why not just saturate? e.g. if(nScore < std::max<int>)nScore++ "No performance impact (64-bit integers are efficient on modern systems)" sounds like LLM blather, the relevant criteria is not the performance of 64-bit integers considering how little it's used. Memory usage might matter if this was a per-peer (or per-block/header) field, but it isn't. The purpose of it is to track input addresses to see that they were, in fact, reachable. I'm pretty sure that by the 2 billionth connection claiming to connect to it that the matter is settled. |
76295ef to
c5c16ad
Compare
|
@gmaxwell Thank you for the excellent feedback! |
|
Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened. Marking as up for grabs. |
I would like to continue to work on this.. |
The
nScorefield inLocalServiceInfostruct was defined asint(32-bit signed integer), which could overflow fromINT_MAX(2,147,483,647) toINT_MIN(-2,147,483,648) when incremented bySeenLocal()during version handshakes. This is undefined behavior in C++ and could affect address selection logic.Implement saturation in
SeenLocal()to capnScoreatstd::numeric_limits<int>::max()instead of allowing overflow. This prevents undefined behavior while maintaining memory efficiency and logical correctness - after 2 billion connections, the matter is settled.Fixes #24049