feat: Add ports field to server_info RPC (#2476)

This commit is contained in:
Jackson Mills
2023-09-15 13:52:38 -07:00
committed by GitHub
parent 7679df4551
commit cad0a2a163
3 changed files with 39 additions and 2 deletions

View File

@@ -4,7 +4,10 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
## Unreleased
## Fixed
### Added
* Added `ports` field to `ServerInfoResponse`
### Fixed
* Fix request model fields related to AMM
* Fixed `EscrowCancel` and `EscrowFinish` validation

View File

@@ -33,6 +33,22 @@ export interface JobType {
in_progress?: number
}
export type protocol =
| 'http'
| 'https'
| 'grpc'
| 'peer'
| 'ws'
| 'ws2'
| 'wss'
| 'wss2'
export interface ServerPort {
port: string
/** The values in protocol are sorted in alphabetical order */
protocol: protocol[]
}
// The states for validating and proposing do not exist in the field state_accounting
// See https://github.com/XRPLF/rippled/blob/develop/src/ripple/app/misc/NetworkOPs.cpp#L4545
// https://github.com/XRPLF/rippled/blob/develop/src/ripple/app/misc/NetworkOPs.h#L66
@@ -181,6 +197,11 @@ export interface ServerInfoResponse extends BaseResponse {
network_ledger?: 'waiting'
/** How many other rippled servers this one is currently connected to. */
peers: number
/**
* What Websocket/RPC ports rippled is listening on. This allows crawlers to build a richer topology without needing to
* port-scan nodes. For non-admin users (including peers), info about admin ports is excluded.
*/
ports: ServerPort[]
/**
* Public key used to verify this server for peer-to-peer communications.
* This node key pair is automatically generated by the server the first

View File

@@ -56,6 +56,20 @@ describe('server_info (rippled)', function () {
peer_disconnects: '0',
peer_disconnects_resources: '0',
peers: 0,
ports: [
{
port: '5005',
protocol: ['http'],
},
{
port: '80',
protocol: ['ws'],
},
{
port: '6006',
protocol: ['ws'],
},
],
pubkey_node: 'n9K6DaaReKkCjb9sEfXh5xP3BV9JisrJ9biKB3CSSFXancBnv5cW',
pubkey_validator: 'none',
server_state: 'full',
@@ -111,7 +125,6 @@ describe('server_info (rippled)', function () {
'build_version',
'node_size',
'initial_sync_duration_us',
'ports',
]
assert.deepEqual(
omit(response.result.info, removeKeys),