diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-03-19 20:47:04 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-03-19 20:47:10 +0100 |
commit | 18cd0888ef6285f5f496c01bbcf6884565def06f (patch) | |
tree | 0bf53c62e72aa2a14deaa155ba5f7df2f771675e /src/net.h | |
parent | 7f3fd341178f08c9ddb5b959e02676ad6bca3370 (diff) | |
parent | 52dd40a9febec1f4e70d777821b6764830bdec61 (diff) |
Merge #21328: net, refactor: pass uint16 CService::port as uint16
52dd40a9febec1f4e70d777821b6764830bdec61 test: add missing netaddress include headers (Jon Atack)
6f09c0f6b57ac01a473c587a3e51e9d477866bb0 util: add missing braces and apply clang format to SplitHostPort() (Jon Atack)
2875a764f7d8b1503c7bdb2f262964f7a0cb5fc3 util: add ParseUInt16(), use it in SplitHostPort() (Jon Atack)
6423c8175fad3163c10ffdb49e0df48e4e4931f1 p2p, refactor: pass and use uint16_t CService::port as uint16_t (Jon Atack)
Pull request description:
As noticed during review today in https://github.com/bitcoin/bitcoin/pull/20685#discussion_r584873708 of the upcoming I2P network support, `CService::port` is `uint16_t` but is passed around the codebase and into the ctors as `int`, which causes uneeded conversions and casts. We can avoid these (including in the incoming I2P code without further changes to it) by using ports with the correct type. The remaining conversions are pushed out to the user input boundaries where they can be range-checked and raise with user feedback in the next patch.
ACKs for top commit:
practicalswift:
cr ACK 52dd40a9febec1f4e70d777821b6764830bdec61: patch looks correct
MarcoFalke:
cr ACK 52dd40a9febec1f4e70d777821b6764830bdec61
vasild:
ACK 52dd40a9febec1f4e70d777821b6764830bdec61
Tree-SHA512: 203c1cab3189a206c55ecada77b9548b810281cdc533252b8e3330ae0606b467731c75f730ce9deb07cbaab66facf97e1ffd2051084ff9077cba6750366b0432
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -229,7 +229,7 @@ extern std::string strSubVersion; struct LocalServiceInfo { int nScore; - int nPort; + uint16_t nPort; }; extern RecursiveMutex cs_mapLocalHost; |