kaspad/app/rpc/rpchandlers/get_block_count.go
2023-08-23 15:18:10 +09:00

18 lines
578 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"
)
// HandleGetBlockCount handles the respectively named RPC command
func HandleGetBlockCount(context *rpccontext.Context, _ *router.Router, _ appmessage.Message) (appmessage.Message, error) {
syncInfo, err := context.Domain.Consensus().GetSyncInfo()
if err != nil {
return nil, err
}
response := appmessage.NewGetBlockCountResponseMessage(syncInfo)
return response, nil
}