kaspad/server/rpc/handle_get_info.go
Svarog 2de3c1d0d4
[NOD-1160] Convert *config.Config from singleton to an object that is being passed around (#802)
* [NOD-1160] remove activeConfig from config package + update main

* [NOD-1160] Update main and addrmanager

* [NOD-1160] Update netAdapater

* [NOD-1160] Update connmanager

* [NOD-1160] Fix connmgr package

* [NOD-1160] Fixed DNSSeed functions

* [NOD-1160] Fixed protocol package and subpackages

* [NOD-1160] Fix p2p package

* [NOD-1160] Fix rpc package

* [NOD-1160] Fix kaspad a final time

* [NOD-1160] Make dnsseed.SeedFromDNS callable outside kaspad

* [NOD-1160] Fix tests

* [NOD-1160] Pass cfg to kaspad

* [NOD-1160] Add comment and remove redundant object

* [NOD-1160] Fix typo
2020-07-20 14:33:35 +03:00

25 lines
797 B
Go

package rpc
import (
"github.com/kaspanet/kaspad/rpcmodel"
"github.com/kaspanet/kaspad/version"
)
// handleGetInfo implements the getInfo command. We only return the fields
// that are not related to wallet functionality.
func handleGetInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
ret := &rpcmodel.InfoDAGResult{
Version: version.Version(),
ProtocolVersion: int32(maxProtocolVersion),
Blocks: s.cfg.DAG.BlockCount(),
Connections: s.cfg.ConnMgr.ConnectedCount(),
Proxy: s.appCfg.Proxy,
Difficulty: getDifficultyRatio(s.cfg.DAG.CurrentBits(), s.cfg.DAGParams),
Testnet: s.appCfg.Testnet,
Devnet: s.appCfg.Devnet,
RelayFee: s.appCfg.MinRelayTxFee.ToKAS(),
}
return ret, nil
}