Correct getpeerinfo JSON marshalling for omitempty.

The fields of the PeerInfo should not have been marked omit as the only
ones that should be omitted to for compatibility are the SyncNode and
BanScore fields.
This commit is contained in:
Dave Collins 2013-12-27 19:25:20 -06:00
parent 3faa256f75
commit ca14702e5d

View file

@ -260,17 +260,17 @@ func (s *server) handleBroadcastMsg(state *peerState, bmsg *broadcastMsg) {
// PeerInfo represents the information requested by the getpeerinfo rpc command. // PeerInfo represents the information requested by the getpeerinfo rpc command.
type PeerInfo struct { type PeerInfo struct {
Addr string `json:"addr,omitempty"` Addr string `json:"addr"`
Services string `json:"services,omitempty"` Services string `json:"services"`
LastSend int64 `json:"lastsend,omitempty"` LastSend int64 `json:"lastsend"`
LastRecv int64 `json:"lastrecv,omitempty"` LastRecv int64 `json:"lastrecv"`
BytesSent int `json:"bytessent,omitempty"` BytesSent int `json:"bytessent"`
BytesRecv int `json:"bytesrecv,omitempty"` BytesRecv int `json:"bytesrecv"`
ConnTime int64 `json:"conntime,omitempty"` ConnTime int64 `json:"conntime"`
Version uint32 `json:"version,omitempty"` Version uint32 `json:"version"`
SubVer string `json:"subver,omitempty"` SubVer string `json:"subver"`
Inbound bool `json:"inbound,omitempty"` Inbound bool `json:"inbound"`
StartingHeight int32 `json:"startingheight,omitempty"` StartingHeight int32 `json:"startingheight"`
BanScore int `json:"banscore,omitempty"` BanScore int `json:"banscore,omitempty"`
SyncNode bool `json:"syncnode,omitempty"` SyncNode bool `json:"syncnode,omitempty"`
} }