NodeInfo not a pointer

This commit is contained in:
Ethan Buchman
2018-01-14 00:10:29 -05:00
parent 08f84cd712
commit 8b74a8d6ac
11 changed files with 33 additions and 43 deletions

View File

@@ -41,7 +41,7 @@ func NetInfo() (*ctypes.ResultNetInfo, error) {
peers := []ctypes.Peer{}
for _, peer := range p2pSwitch.Peers().List() {
peers = append(peers, ctypes.Peer{
NodeInfo: *peer.NodeInfo(),
NodeInfo: peer.NodeInfo(),
IsOutbound: peer.IsOutbound(),
ConnectionStatus: peer.Status(),
})

View File

@@ -30,7 +30,7 @@ type P2P interface {
Listeners() []p2p.Listener
Peers() p2p.IPeerSet
NumPeers() (outbound, inbound, dialig int)
NodeInfo() *p2p.NodeInfo
NodeInfo() p2p.NodeInfo
IsListening() bool
DialPeersAsync(*p2p.AddrBook, []string, bool) error
}

View File

@@ -54,7 +54,7 @@ func NewResultCommit(header *types.Header, commit *types.Commit,
}
type ResultStatus struct {
NodeInfo *p2p.NodeInfo `json:"node_info"`
NodeInfo p2p.NodeInfo `json:"node_info"`
PubKey crypto.PubKey `json:"pub_key"`
LatestBlockHash data.Bytes `json:"latest_block_hash"`
LatestAppHash data.Bytes `json:"latest_app_hash"`
@@ -64,7 +64,7 @@ type ResultStatus struct {
}
func (s *ResultStatus) TxIndexEnabled() bool {
if s == nil || s.NodeInfo == nil {
if s == nil {
return false
}
for _, s := range s.NodeInfo.Other {