func (s *Server) NetworkStatus(ctx context.Context, req *rtypes.NetworkRequest) (
	*rtypes.NetworkStatusResponse, *rtypes.Error) {
	hash, height, block, err := s.bestBlock(ctx)
	if err != nil {
		return nil, types.RError(err)
	}
	timestamp := block.Header.Timestamp.Unix() * 1000
	peers, err := s.c.GetPeerInfo(ctx)
	if err != nil {
		return nil, types.RError(err)
	}
	rpeers := make([]*rtypes.Peer, len(peers))
	for i, p := range peers {
		rpeers[i] = &rtypes.Peer{
			PeerID: strconv.FormatInt(int64(p.ID), 10),
			Metadata: map[string]interface{}{
				"addr":      p.Addr,
				"inbound":   p.Inbound,
				"conn_time": p.ConnTime,
			},
		}
	}
	s.mtx.Lock()
	syncStatus := s.syncStatus
	s.mtx.Unlock()
	return &rtypes.NetworkStatusResponse{
		CurrentBlockIdentifier: &rtypes.BlockIdentifier{
			Hash:  hash.String(),
			Index: height,
		},
		CurrentBlockTimestamp: timestamp,
		GenesisBlockIdentifier: &rtypes.BlockIdentifier{
			Hash: s.chainParams.GenesisHash.String(),
		},
		Peers:      rpeers,
		SyncStatus: &syncStatus,
	}, nil
}
NetworkStatus returns the current status of the chain as seen by dcrros and
the underlying dcrd.

This is part of the NetworkAPIServicer interface.
package backend
import (
	"context"
	"runtime"
	"strconv"
	"decred.org/dcrros/internal/version"
	"decred.org/dcrros/types"
	rserver "github.com/coinbase/rosetta-sdk-go/server"
	rtypes "github.com/coinbase/rosetta-sdk-go/types"
)
var _ rserver.NetworkAPIServicer = (*Server)(nil)
func (s *Server) NetworkList(context.Context, *rtypes.MetadataRequest) (
	*rtypes.NetworkListResponse, *rtypes.Error) {
	return &rtypes.NetworkListResponse{
		NetworkIdentifiers: []*rtypes.NetworkIdentifier{
			s.network,
		},
	}, nil
}
func (s *Server) NetworkOptions(context.Context, *rtypes.NetworkRequest) (
	*rtypes.NetworkOptionsResponse, *rtypes.Error) {
	dcrrosVersion := version.String()
	s.mtx.Lock()
	dcrdVersion := s.dcrdVersion
	s.mtx.Unlock()
	versionMeta := make(map[string]interface{})
	versionMeta["build_metadata"] = version.BuildMetadata
	versionMeta["runtime"] = runtime.Version()
	return &rtypes.NetworkOptionsResponse{
		Version: &rtypes.Version{
			RosettaVersion:    rosettaVersion,
			NodeVersion:       dcrdVersion,
			MiddlewareVersion: &dcrrosVersion,
			Metadata:          versionMeta,
		},
		Allow: &rtypes.Allow{
			OperationStatuses: types.AllOpStatus(),
			OperationTypes:    types.AllOpTypes(),
			Errors:            types.AllErrors(),
		},
	}, nil
}