rpc: add n_peers to /net_info

This commit is contained in:
Ethan Buchman
2018-04-28 16:09:12 -04:00
parent 6805ddf1b8
commit c90bf77566
4 changed files with 11 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import (
// {
// "error": "",
// "result": {
// "n_peers": 0,
// "peers": [],
// "listeners": [
// "Listener(@10.0.2.15:46656)"
@ -47,11 +48,13 @@ func NetInfo() (*ctypes.ResultNetInfo, error) {
ConnectionStatus: peer.Status(),
})
}
// TODO: should we include "num_peers" field for convenience ?
// Let's also include the PersistentPeers and Seeds in here.
// TODO: Should we include PersistentPeers and Seeds in here?
// PRO: useful info
// CON: privacy
return &ctypes.ResultNetInfo{
Listening: listening,
Listeners: listeners,
NPeers: len(peers),
Peers: peers,
}, nil
}