mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-28 00:03:39 +00:00
27 lines
827 B
Go
27 lines
827 B
Go
package rpchandlers
|
|
|
|
import (
|
|
"github.com/c4ei/YunSeokYeol/app/appmessage"
|
|
"github.com/c4ei/YunSeokYeol/app/rpc/rpccontext"
|
|
"github.com/c4ei/YunSeokYeol/infrastructure/network/netadapter/router"
|
|
"github.com/c4ei/YunSeokYeol/version"
|
|
)
|
|
|
|
// HandleGetInfo handles the respectively named RPC command
|
|
func HandleGetInfo(context *rpccontext.Context, _ *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
|
isNearlySynced, err := context.Domain.Consensus().IsNearlySynced()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
response := appmessage.NewGetInfoResponseMessage(
|
|
context.NetAdapter.ID().String(),
|
|
uint64(context.Domain.MiningManager().TransactionCount(true, false)),
|
|
version.Version(),
|
|
context.Config.UTXOIndex,
|
|
context.ProtocolManager.Context().HasPeers() && isNearlySynced,
|
|
)
|
|
|
|
return response, nil
|
|
}
|