kaspad/network/rpc/handle_get_info.go
Ori Newman f2a3ccd9ab
[NOD-1271] Move version package to the top level (#871)
* [NOD-1271] Move version package to the top level

* [NOD-1271] Fix imports
2020-08-16 17:16:11 +03:00

25 lines
794 B
Go

package rpc
import (
"github.com/kaspanet/kaspad/network/rpc/model"
"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 := &model.InfoDAGResult{
Version: version.Version(),
ProtocolVersion: int32(maxProtocolVersion),
Blocks: s.dag.BlockCount(),
Connections: int32(s.connectionManager.ConnectionCount()),
Proxy: s.cfg.Proxy,
Difficulty: getDifficultyRatio(s.dag.CurrentBits(), s.dag.Params),
Testnet: s.cfg.Testnet,
Devnet: s.cfg.Devnet,
RelayFee: s.cfg.MinRelayTxFee.ToKAS(),
}
return ret, nil
}