XRPLF / rippled

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

Peer crawler port field type inconsistency #5029

Open mDuo13 opened 4 weeks ago

mDuo13 commented 4 weeks 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 4 weeks 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.