netaddress: make .onion suffix check case-insensitive #36636

Manually merged
jpk68 merged 1 commit from onion-check into master 2026-11-03 20:28:57 +00:00 AGit
jpk68 commented 2026-10-24 02:18:53 +00:00 (Migrated from github.com)

Makes the suffix/TLD check case-insensitive when parsing .onion addresses, as is already done for I2P hostnames. With the current code, a name like <addr>.ONION will not be parsed as a Tor address, and will instead fall through to regular hostname resolution.

Makes the suffix/TLD check case-insensitive when parsing `.onion` addresses, as is already done for I2P hostnames. With the current code, a name like `<addr>.ONION` will not be parsed as a Tor address, and will instead fall through to regular hostname resolution.
DrahtBot commented 2026-10-24 02:19:02 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK vasild, AndreaDiazCorreia, Husteem, winterrdog, sedited

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36636 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36636.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36636#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [vasild](https://github.com/bitcoin/bitcoin/pull/36636#pullrequestreview-5637653085), [AndreaDiazCorreia](https://github.com/bitcoin/bitcoin/pull/36636#pullrequestreview-5643376401), [Husteem](https://github.com/bitcoin/bitcoin/pull/36636#issuecomment-6423711667), [winterrdog](https://github.com/bitcoin/bitcoin/pull/36636#pullrequestreview-5659812839), [sedited](https://github.com/bitcoin/bitcoin/pull/36636#pullrequestreview-5758978070) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

Base: 2b5b6fe231ff45a09d9e24411e4420d51ed45cab
Head: 0574f096abf0cfe75501542efe1787679340d3d3

I found no actionable issues in this static review.

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:61069f0ded2b37aeee28d0416237ff18ab62386bb6fcdafc637bca25f525aaef:86b9a0e22bd2eb7ab1b7eb621b9854197174a699ec1bc40495f2801bb5137d33 --> Base: `2b5b6fe231ff45a09d9e24411e4420d51ed45cab` Head: `0574f096abf0cfe75501542efe1787679340d3d3` I found no actionable issues in this static review. [Full review report](<https://review.fish.foo/traces/36636-0574f096abf0cfe75501542efe1787679340d3d3-1399-2.html>)
vasild (Migrated from github.com) approved these changes 2026-10-24 09:08:51 +00:00
vasild (Migrated from github.com) left a comment

ACK 0574f096ab

Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK 0574f096abf0cfe75501542efe1787679340d3d3
-----BEGIN PGP SIGNATURE-----

iQRPBAEBCAA5FiEE5k2NRWFNsHVF2czBVN8G9ktVy78FAmrcdTobFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwzAAoJEFT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chNh6l4GYZJzLsxWmw4F/Ewbk8hVsBDVBWT7/COdgkcMFZyIgQWHGY7Ly2gTU
axo4yheGa1fqz0c99JtsHdk8EDO/SayOKNYtDzmriIcDQMQfSoSkdyW9W8dPCFgY
ozJnUKz6JWeA9hbJvOJvoJjeH27RCjlXgXtX/F3ZVNv84NntXm4jTr/oBG9VLGi/
3OZt/2kd1Sy6QRYRw7/FQ6MkYRGhIGdJmfURRTtDZGO6ma6Z4znPAtU7KBK6mvP1
fJWg3LJiLYPHLn1JnVPR556g6QhUEHY2kIQodYb8qMSwRgJVH3n+ASB0+D/P8eaw
0r4=
=f7eZ
-----END PGP SIGNATURE-----

vasild's public key is on openpgp.org

ACK 0574f096abf0cfe75501542efe1787679340d3d3 <details> <summary>Show Signature</summary> ``` -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 ACK 0574f096abf0cfe75501542efe1787679340d3d3 -----BEGIN PGP SIGNATURE----- iQRPBAEBCAA5FiEE5k2NRWFNsHVF2czBVN8G9ktVy78FAmrcdTobFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwzAAoJEFTfBvZLVcu/dV8f/1vDOoGWU1M0Q8ClJaod UATWwEHNI47tXPISqPpqoqtISp8Kv1MBeSX4GjVZhpDPRcqRdBfMPyC2GigQgiwY OiS8fjwvBsK+28XigejMSd4vWJdxUpzLBv8lsZaCDeGLWDirVEbPTdbWYKF47A4G IE5K3PunX7kUaRGOz/pE/NEVyLvE4L715SMstp2imx3Srnnw48XZmFekAU7jUG8M HJcX2g1K3X58P77vwsYv2LyXJlWkZ5FejcwBYg2we5YCQGjNEEtDrd7/knmw1bx9 GLtXZNxmqEajPnZAopQKqZWsMIaJO3Am6+fYDXaweZSVhoWpvY4miMYmxPxIY5v/ wcTl/YYV5G3KMbxSBvFo5rW3ew9QI3hxIc1rEKDFI4+JzYIdd8LpcK/qdGvKrgEz 5knSPDm5OGqN+W9k3nIGIs9eFdAlLuKJNDpJVeg+i/wB5q4sLyuktXeK4LdFkXBR 7q+Fl4VcWJDgpKaEVnGVvg9Ggf3HtOfkUzMkMznxPtwUZ7im1utCxePqOS4kC0AO ZBpOr7Hw8gvwCmlvIKN+vEWU7nikRljesESC4izn4NfTbcS/QICurF7By2o35jG0 OF2M9ey2nuQfmiRzn/lIzi39kiugKcDAHMBTUoa5mLduX/VOVIPey6lT5kI4zOML FyShu1tuaRvwvAG0tAuwFS4WgZGO/0YPQls/8ALYnlKe9WwAoIzsY7RvFPlpQoIw A95EKFvI1LlgJ4ZLhMgeAF2i7dInMI8N0lUIdGWgnUxUiAXlisAva6KFbWBg/PcH WwkC6Hbo9iz+shuBoH9fWwdON7eZkFxGZbOBHPNasNhJIZ8Xj0wBXREUW8z/7OqT q6Yot8V6/2Z8mdieH9uJlXFpslGhqmTgZU/gdUUz105B3yFyCJIP12hkrzKLmIPi FgKFf6mnYbeg8RL4NCmDzzUfvC4dlSvRaWsS1JhhyGglhL3PR/q/NU4bZe0omb7h 0gTzLgC2k1J5OunyghLgX7YRfFefoNcQUB4unt+VciYTZ4MSBd6jwPFZ07Ft3uGF xL2chNh6l4GYZJzLsxWmw4F/Ewbk8hVsBDVBWT7/COdgkcMFZyIgQWHGY7Ly2gTU axo4yheGa1fqz0c99JtsHdk8EDO/SayOKNYtDzmriIcDQMQfSoSkdyW9W8dPCFgY ozJnUKz6JWeA9hbJvOJvoJjeH27RCjlXgXtX/F3ZVNv84NntXm4jTr/oBG9VLGi/ 3OZt/2kd1Sy6QRYRw7/FQ6MkYRGhIGdJmfURRTtDZGO6ma6Z4znPAtU7KBK6mvP1 fJWg3LJiLYPHLn1JnVPR556g6QhUEHY2kIQodYb8qMSwRgJVH3n+ASB0+D/P8eaw 0r4= =f7eZ -----END PGP SIGNATURE----- ``` vasild's public key is [on openpgp.org](https://keys.openpgp.org/vks/v1/by-fingerprint/850E138BA9C0923881DFD55FCE712013582E2230) </details>
AndreaDiazCorreia (Migrated from github.com) reviewed 2026-10-25 13:24:27 +00:00
AndreaDiazCorreia (Migrated from github.com) left a comment

ACK 0574f096ab

Built and ran net_tests, netbase_tests, and base32_tests successfully. Confirmed the new test fails with the parent’s netaddress.cpp.

ACK 0574f096abf0cfe75501542efe1787679340d3d3 Built and ran net_tests, netbase_tests, and base32_tests successfully. Confirmed the new test fails with the parent’s netaddress.cpp.
Husteem commented 2026-10-26 18:08:24 +00:00 (Migrated from github.com)

ACK 0574f09

One non-blocking nit
ToLower(addr.substr(...)) creates a temporary std::string (though 6 chars fits within SSO).
Using CaseInsensitiveEqual(addr.substr(addr.size() - suffix.size()), suffix) from util/strencodings.h avoids the temporary string entirely.
It would be nice to use that here (and similarly in SetI2P()) for consistency,

ACK [0574f09](https://github.com/bitcoin/bitcoin/pull/36636/commits/0574f096abf0cfe75501542efe1787679340d3d3) One non-blocking nit `ToLower(addr.substr(...))` creates a temporary `std::string` (though 6 chars fits within SSO). Using `CaseInsensitiveEqual(addr.substr(addr.size() - suffix.size()), suffix)` from `util/strencodings.h` avoids the temporary string entirely. It would be nice to use that here (and similarly in SetI2P()) for consistency,
winterrdog (Migrated from github.com) reviewed 2026-10-26 22:12:51 +00:00
winterrdog (Migrated from github.com) left a comment

tested ACK 0574f096ab

successfully built and tested on: Windows 10/MSVC 19.51.36257/x86_64. changes LGTM and the intent is pragmatic

tested ACK 0574f096abf0cfe75501542efe1787679340d3d3 successfully built and tested on: Windows `10`/MSVC `19.51.36257`/`x86_64`. changes LGTM and the intent is pragmatic
sedited (Migrated from github.com) approved these changes 2026-11-03 20:24:44 +00:00
sedited (Migrated from github.com) left a comment
ACK 0574f096abf0cfe75501542efe1787679340d3d3
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36636
No description provided.