Page MenuHomePhabricator

p2p, refactor: pass and use uint16_t CService::port as uint16_t
ClosedPublic

Authored by PiRK on Feb 18 2022, 16:53.

Details

Summary

As noticed during review of the 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.

This is a backport of core#21328 [1/3]
https://github.com/bitcoin/bitcoin/pull/21328/commits/6423c8175fad3163c10ffdb49e0df48e4e4931f1

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable