XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.54k stars 1.47k forks source link

Peer crawler port field type inconsistency #5029

Open mDuo13 opened 6 months ago

mDuo13 commented 6 months ago

Issue Description

The "Peer Crawler" special API method reports the port of peers as either an integer or a string depending on if the connection is inbound/outbound. This was probably an oversight in the original PR, and the field should be consistently the same type.

Steps to Reproduce

Call the peer crawler on a server that has both incoming and outgoing peers and check the response.

Expected Result

The port fields in the overlay.active[] array members should all be the same type, probably Number. Port numbers should always fit in any reasonable primitive that JSON numbers can be deserialized into.

Solution

Always make port a Number type. Note, this is (kind of) an API change, but to a special peer-port-API method and not to the standard API, so API versioning concerns do not apply.

Environment

rippled 1.2.1 through 2.1.x

Related issues

intelliot commented 6 months ago

Note, this is (kind of) an API change, but to a special peer-port-API method and not to the standard API, so API versioning concerns do not apply.

Agreed. Let's make sure it gets at least a mention in the release notes though.