func (s *server) GetStateRoot(ctx context.Context, in *pb.GetStateRootRequest) (*pb.GetStateRootResponse, error) {
	h, err := chainhash.NewHash(in.BlockHash)
	if err != nil {
		return nil, err
	}

	n := s.chain.View.Index.GetBlockNodeByHash(*h)

	if n != nil {
		return &pb.GetStateRootResponse{StateRoot: n.StateRoot[:]}, nil
	} else {
		return nil, fmt.Errorf("missing state for hash %s", h)
	}
}
// GetStateRoot gets the hash of the state in the main chain.
GetStateRoot gets the hash of the state in the main chain.
// GetStateRoot gets the hash of the state in the main chain .
func (s *server) GetStateRoot(ctx context.Context, in *pb.GetStateRootRequest) (*pb.GetStateRootResponse, error) {
	h, err := chainhash.NewHash(in.BlockHash)
	if err != nil {
		return nil, err
	}
	n := s.chain.View.Index.GetBlockNodeByHash(*h)
	if n != nil {
		return &pb.GetStateRootResponse{StateRoot: n.StateRoot[:]}, nil
	} else {
		return nil, fmt.Errorf("missing state for hash %s", h)
	}
}
func ( s * server ) GetStateRoot ( ctx context . Context , in * pb . GetStateRootRequest ) ( * pb . GetStateRootResponse , error ) { h , err := chainhash . NewHash ( in . BlockHash ) if err != nil { return nil , err } n := s . chain . View . Index . GetBlockNodeByHash ( * h ) if n != nil { return & pb . GetStateRootResponse { StateRoot : n . StateRoot [ : ] } , nil } else { return nil , fmt . Errorf ( " " , h ) } }
GetStateRoot gets the hash of the state in the main chain.
GetStateRoot gets the hash of the state in the main chain .