func openRPCKeyPair() (tls.Certificate, error) {
	_, e := os.Stat(cfg.RPCKey.Value)
	keyExists := !os.IsNotExist(e)
	switch {
	case cfg.OneTimeTLSKey && keyExists:
		err := fmt.Errorf("one time TLS keys are enabled, but TLS key "+
			"`%s` already exists", cfg.RPCKey)
		return tls.Certificate{}, err
	case cfg.OneTimeTLSKey:
		return generateRPCKeyPair(false)
	case !keyExists:
		return generateRPCKeyPair(true)
	default:
		return tls.LoadX509KeyPair(cfg.RPCCert.Value, cfg.RPCKey.Value)
	}
}
openRPCKeyPair creates or loads the RPC TLS keypair specified by the
application config.  This function respects the cfg.OneTimeTLSKey setting.
package main
import (
	"crypto/tls"
	"errors"
	"fmt"
	xcontext "golang.org/x/net/context"
	"io/ioutil"
	"net"
	"os"
	"path/filepath"
	"runtime"
	"strings"
	"time"
	"github.com/HcashOrg/hcashutil"
	"github.com/HcashOrg/hcashwallet/loader"
	"github.com/HcashOrg/hcashwallet/rpc/legacyrpc"
	"github.com/HcashOrg/hcashwallet/rpc/rpcserver"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
	"google.golang.org/grpc/peer"
)