btcjson: Update GetNetworkInfoResult.

This updates the GetNetworkInfoResult structure to include the latest
fields added to Core for compatibility purposes.

While here, also move the definitions of the subtypes for the result
before their use for consistency.
This commit is contained in:
Dave Collins 2017-05-18 07:44:49 -05:00
parent 7d3ca6df7b
commit 1fee394e08
No known key found for this signature in database
GPG key ID: B8904D9D9C93D1F2

View file

@ -192,16 +192,39 @@ type GetMempoolInfoResult struct {
Bytes int64 `json:"bytes"`
}
// NetworksResult models the networks data from the getnetworkinfo command.
type NetworksResult struct {
Name string `json:"name"`
Limited bool `json:"limited"`
Reachable bool `json:"reachable"`
Proxy string `json:"proxy"`
ProxyRandomizeCredentials bool `json:"proxy_randomize_credentials"`
}
// LocalAddressesResult models the localaddresses data from the getnetworkinfo
// command.
type LocalAddressesResult struct {
Address string `json:"address"`
Port uint16 `json:"port"`
Score int32 `json:"score"`
}
// GetNetworkInfoResult models the data returned from the getnetworkinfo
// command.
type GetNetworkInfoResult struct {
Version int32 `json:"version"`
SubVersion string `json:"subversion"`
ProtocolVersion int32 `json:"protocolversion"`
LocalServices string `json:"localservices"`
LocalRelay bool `json:"localrelay"`
TimeOffset int64 `json:"timeoffset"`
Connections int32 `json:"connections"`
NetworkActive bool `json:"networkactive"`
Networks []NetworksResult `json:"networks"`
RelayFee float64 `json:"relayfee"`
IncrementalFee float64 `json:"incrementalfee"`
LocalAddresses []LocalAddressesResult `json:"localaddresses"`
Warnings string `json:"warnings"`
}
// GetPeerInfoResult models the data returned from the getpeerinfo command.
@ -415,22 +438,6 @@ type InfoChainResult struct {
Errors string `json:"errors"`
}
// LocalAddressesResult models the localaddresses data from the getnetworkinfo
// command.
type LocalAddressesResult struct {
Address string `json:"address"`
Port uint16 `json:"port"`
Score int32 `json:"score"`
}
// NetworksResult models the networks data from the getnetworkinfo command.
type NetworksResult struct {
Name string `json:"name"`
Limited bool `json:"limited"`
Reachable bool `json:"reachable"`
Proxy string `json:"proxy"`
}
// TxRawResult models the data from the getrawtransaction command.
type TxRawResult struct {
Hex string `json:"hex"`