mirror of
https://github.com/status-im/status-go.git
synced 2025-02-19 18:28:18 +00:00
Add http enable flag for Node, closes #191
* Add http enable flag for Node * Fix errors with json test data * Refactor changes with regards to review comments * Return appropriate errors for novalue set * Update changes with regard to config * Update tests timeout value for makefile ci * Add RPCEnabled for json config in api test * Resolve test with RPCEnabled changes * Remove RPCEnabled flag from unconcerned tests
This commit is contained in:
parent
b3a56eb00b
commit
fb7738b1bb
12
Makefile
12
Makefile
@ -47,12 +47,12 @@ statusgo-ios-simulator-mainnet: xgo
|
|||||||
@echo "iOS framework cross compilation done (mainnet)."
|
@echo "iOS framework cross compilation done (mainnet)."
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
build/env.sh go test -v ./geth/api
|
build/env.sh go test -timeout 40m -v ./geth/api
|
||||||
build/env.sh go test -v ./geth/common
|
build/env.sh go test -timeout 40m -v ./geth/common
|
||||||
build/env.sh go test -v ./geth/jail
|
build/env.sh go test -timeout 40m -v ./geth/jail
|
||||||
build/env.sh go test -v ./geth/node
|
build/env.sh go test -timeout 40m -v ./geth/node
|
||||||
build/env.sh go test -v ./geth/params
|
build/env.sh go test -timeout 40m -v ./geth/params
|
||||||
build/env.sh go test -v ./extkeys
|
build/env.sh go test -timeout 40m -v ./extkeys
|
||||||
|
|
||||||
generate:
|
generate:
|
||||||
cp ./node_modules/web3/dist/web3.js ./static/scripts/web3.js
|
cp ./node_modules/web3/dist/web3.js ./static/scripts/web3.js
|
||||||
|
@ -46,6 +46,7 @@ func (s *APITestSuite) TestCHTUpdate() {
|
|||||||
"DataDir": "` + tmpDir + `",
|
"DataDir": "` + tmpDir + `",
|
||||||
"LogEnabled": true,
|
"LogEnabled": true,
|
||||||
"LogLevel": "INFO",
|
"LogLevel": "INFO",
|
||||||
|
"RPCEnabled": true,
|
||||||
"LightEthConfig": {
|
"LightEthConfig": {
|
||||||
"CHTRootConfigURL": "` + url + `"
|
"CHTRootConfigURL": "` + url + `"
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ func (s *BackendTestSuite) TestDiscardQueuedTransaction() {
|
|||||||
|
|
||||||
// make sure you panic if transaction complete doesn't return
|
// make sure you panic if transaction complete doesn't return
|
||||||
completeQueuedTransaction := make(chan struct{}, 1)
|
completeQueuedTransaction := make(chan struct{}, 1)
|
||||||
common.PanicAfter(20*time.Second, completeQueuedTransaction, s.T().Name())
|
common.PanicAfter(30*time.Second, completeQueuedTransaction, s.T().Name())
|
||||||
|
|
||||||
// replace transaction notification handler
|
// replace transaction notification handler
|
||||||
var txID string
|
var txID string
|
||||||
@ -434,7 +434,7 @@ func (s *BackendTestSuite) TestCompleteMultipleQueuedTransactions() {
|
|||||||
select {
|
select {
|
||||||
case <-allTestTxCompleted:
|
case <-allTestTxCompleted:
|
||||||
// pass
|
// pass
|
||||||
case <-time.After(20 * time.Second):
|
case <-time.After(30 * time.Second):
|
||||||
s.Fail("test timed out")
|
s.Fail("test timed out")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -535,6 +535,7 @@ func (s *BackendTestSuite) TestDiscardMultipleQueuedTransactions() {
|
|||||||
if len(completeResults) != (testTxCount + 1) {
|
if len(completeResults) != (testTxCount + 1) {
|
||||||
s.Fail(fmt.Sprint("unexpected number of errors (call to CompleteTransaction should not succeed)"))
|
s.Fail(fmt.Sprint("unexpected number of errors (call to CompleteTransaction should not succeed)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, txResult := range completeResults {
|
for _, txResult := range completeResults {
|
||||||
if txResult.Error.Error() != "transaction hash not found" {
|
if txResult.Error.Error() != "transaction hash not found" {
|
||||||
s.Fail(fmt.Sprintf("invalid error for %s", txResult.Hash.Hex()))
|
s.Fail(fmt.Sprintf("invalid error for %s", txResult.Hash.Hex()))
|
||||||
@ -572,7 +573,7 @@ func (s *BackendTestSuite) TestDiscardMultipleQueuedTransactions() {
|
|||||||
select {
|
select {
|
||||||
case <-allTestTxDiscarded:
|
case <-allTestTxDiscarded:
|
||||||
// pass
|
// pass
|
||||||
case <-time.After(20 * time.Second):
|
case <-time.After(30 * time.Second):
|
||||||
s.Fail("test timed out")
|
s.Fail("test timed out")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,9 @@ func (m *NodeManager) startNode(config *params.NodeConfig) (<-chan struct{}, err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
m.nodeStarted = make(chan struct{}, 1)
|
m.nodeStarted = make(chan struct{}, 1)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer HaltOnPanic()
|
defer HaltOnPanic()
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ func MakeNode(config *params.NodeConfig) (*node.Node, error) {
|
|||||||
|
|
||||||
// defaultEmbeddedNodeConfig returns default stack configuration for mobile client node
|
// defaultEmbeddedNodeConfig returns default stack configuration for mobile client node
|
||||||
func defaultEmbeddedNodeConfig(config *params.NodeConfig) *node.Config {
|
func defaultEmbeddedNodeConfig(config *params.NodeConfig) *node.Config {
|
||||||
return &node.Config{
|
nc := &node.Config{
|
||||||
DataDir: config.DataDir,
|
DataDir: config.DataDir,
|
||||||
KeyStoreDir: config.KeyStoreDir,
|
KeyStoreDir: config.KeyStoreDir,
|
||||||
UseLightweightKDF: true,
|
UseLightweightKDF: true,
|
||||||
@ -124,8 +124,6 @@ func defaultEmbeddedNodeConfig(config *params.NodeConfig) *node.Config {
|
|||||||
MaxPendingPeers: config.MaxPendingPeers,
|
MaxPendingPeers: config.MaxPendingPeers,
|
||||||
},
|
},
|
||||||
IPCPath: makeIPCPath(config),
|
IPCPath: makeIPCPath(config),
|
||||||
HTTPHost: config.HTTPHost,
|
|
||||||
HTTPPort: config.HTTPPort,
|
|
||||||
HTTPCors: []string{"*"},
|
HTTPCors: []string{"*"},
|
||||||
HTTPModules: strings.Split(config.APIModules, ","),
|
HTTPModules: strings.Split(config.APIModules, ","),
|
||||||
WSHost: makeWSHost(config),
|
WSHost: makeWSHost(config),
|
||||||
@ -133,6 +131,13 @@ func defaultEmbeddedNodeConfig(config *params.NodeConfig) *node.Config {
|
|||||||
WSOrigins: []string{"*"},
|
WSOrigins: []string{"*"},
|
||||||
WSModules: strings.Split(config.APIModules, ","),
|
WSModules: strings.Split(config.APIModules, ","),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.RPCEnabled {
|
||||||
|
nc.HTTPHost = config.HTTPHost
|
||||||
|
nc.HTTPPort = config.HTTPPort
|
||||||
|
}
|
||||||
|
|
||||||
|
return nc
|
||||||
}
|
}
|
||||||
|
|
||||||
// updateCHT changes trusted canonical hash trie root
|
// updateCHT changes trusted canonical hash trie root
|
||||||
@ -263,6 +268,7 @@ func activateShhService(stack *node.Node, config *params.NodeConfig) error {
|
|||||||
log.Info("SHH protocol is disabled")
|
log.Info("SHH protocol is disabled")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
serviceConstructor := func(*node.ServiceContext) (node.Service, error) {
|
serviceConstructor := func(*node.ServiceContext) (node.Service, error) {
|
||||||
whisperConfig := config.WhisperConfig
|
whisperConfig := config.WhisperConfig
|
||||||
whisperService := whisper.New()
|
whisperService := whisper.New()
|
||||||
|
@ -34,8 +34,11 @@ var (
|
|||||||
ErrMissingDataDir = errors.New("missing required 'DataDir' parameter")
|
ErrMissingDataDir = errors.New("missing required 'DataDir' parameter")
|
||||||
ErrMissingNetworkID = errors.New("missing required 'NetworkID' parameter")
|
ErrMissingNetworkID = errors.New("missing required 'NetworkID' parameter")
|
||||||
ErrEmptyPasswordFile = errors.New("password file cannot be empty")
|
ErrEmptyPasswordFile = errors.New("password file cannot be empty")
|
||||||
|
ErrNoPasswordFileValueSet = errors.New("password file path not set")
|
||||||
|
ErrNoIdentityFileValueSet = errors.New("identity file path not set")
|
||||||
ErrEmptyIdentityFile = errors.New("identity file cannot be empty")
|
ErrEmptyIdentityFile = errors.New("identity file cannot be empty")
|
||||||
ErrEmptyAuthorizationKeyFile = errors.New("authorization key file cannot be empty")
|
ErrEmptyAuthorizationKeyFile = errors.New("authorization key file cannot be empty")
|
||||||
|
ErrAuthorizationKeyFileNotSet = errors.New("authorization key file is not set")
|
||||||
)
|
)
|
||||||
|
|
||||||
// LightEthConfig holds LES-related configuration
|
// LightEthConfig holds LES-related configuration
|
||||||
@ -55,6 +58,8 @@ type LightEthConfig struct {
|
|||||||
CHTRootConfigURL string
|
CHTRootConfigURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
|
||||||
// FirebaseConfig holds FCM-related configuration
|
// FirebaseConfig holds FCM-related configuration
|
||||||
type FirebaseConfig struct {
|
type FirebaseConfig struct {
|
||||||
// AuthorizationKeyFile file path that contains FCM authorization key
|
// AuthorizationKeyFile file path that contains FCM authorization key
|
||||||
@ -64,6 +69,28 @@ type FirebaseConfig struct {
|
|||||||
NotificationTriggerURL string
|
NotificationTriggerURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadAuthorizationKeyFile reads and loads FCM authorization key
|
||||||
|
func (c *FirebaseConfig) ReadAuthorizationKeyFile() ([]byte, error) {
|
||||||
|
if len(c.AuthorizationKeyFile) == 0 {
|
||||||
|
return nil, ErrAuthorizationKeyFileNotSet
|
||||||
|
}
|
||||||
|
|
||||||
|
key, err := ioutil.ReadFile(c.AuthorizationKeyFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
key = bytes.TrimRight(key, "\n")
|
||||||
|
|
||||||
|
if len(key) == 0 {
|
||||||
|
return nil, ErrEmptyAuthorizationKeyFile
|
||||||
|
}
|
||||||
|
|
||||||
|
return key, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
|
||||||
// WhisperConfig holds SHH-related configuration
|
// WhisperConfig holds SHH-related configuration
|
||||||
type WhisperConfig struct {
|
type WhisperConfig struct {
|
||||||
// Enabled flag specifies whether protocol is enabled
|
// Enabled flag specifies whether protocol is enabled
|
||||||
@ -107,12 +134,65 @@ type WhisperConfig struct {
|
|||||||
FirebaseConfig *FirebaseConfig `json:"FirebaseConfig,"`
|
FirebaseConfig *FirebaseConfig `json:"FirebaseConfig,"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadPasswordFile reads and returns content of the password file
|
||||||
|
func (c *WhisperConfig) ReadPasswordFile() ([]byte, error) {
|
||||||
|
if len(c.PasswordFile) == 0 {
|
||||||
|
return nil, ErrNoPasswordFileValueSet
|
||||||
|
}
|
||||||
|
|
||||||
|
password, err := ioutil.ReadFile(c.PasswordFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
password = bytes.TrimRight(password, "\n")
|
||||||
|
|
||||||
|
if len(password) == 0 {
|
||||||
|
return nil, ErrEmptyPasswordFile
|
||||||
|
}
|
||||||
|
|
||||||
|
return password, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadIdentityFile reads and loads identity private key
|
||||||
|
func (c *WhisperConfig) ReadIdentityFile() (*ecdsa.PrivateKey, error) {
|
||||||
|
if len(c.IdentityFile) == 0 {
|
||||||
|
return nil, ErrNoIdentityFileValueSet
|
||||||
|
}
|
||||||
|
|
||||||
|
identity, err := crypto.LoadECDSA(c.IdentityFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if identity == nil {
|
||||||
|
return nil, ErrEmptyIdentityFile
|
||||||
|
}
|
||||||
|
|
||||||
|
return identity, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// String dumps config object as nicely indented JSON
|
||||||
|
func (c *WhisperConfig) String() string {
|
||||||
|
data, _ := json.MarshalIndent(c, "", " ")
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
|
||||||
// SwarmConfig holds Swarm-related configuration
|
// SwarmConfig holds Swarm-related configuration
|
||||||
type SwarmConfig struct {
|
type SwarmConfig struct {
|
||||||
// Enabled flag specifies whether protocol is enabled
|
// Enabled flag specifies whether protocol is enabled
|
||||||
Enabled bool
|
Enabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String dumps config object as nicely indented JSON
|
||||||
|
func (c *SwarmConfig) String() string {
|
||||||
|
data, _ := json.MarshalIndent(c, "", " ")
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
|
||||||
// BootClusterConfig holds configuration for supporting boot cluster, which is a temporary
|
// BootClusterConfig holds configuration for supporting boot cluster, which is a temporary
|
||||||
// means for mobile devices to get connected to Ethereum network (UDP-based discovery
|
// means for mobile devices to get connected to Ethereum network (UDP-based discovery
|
||||||
// may not be available, so we need means to discover the network manually).
|
// may not be available, so we need means to discover the network manually).
|
||||||
@ -128,6 +208,14 @@ type BootClusterConfig struct {
|
|||||||
ConfigFile string
|
ConfigFile string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String dumps config object as nicely indented JSON
|
||||||
|
func (c *BootClusterConfig) String() string {
|
||||||
|
data, _ := json.MarshalIndent(c, "", " ")
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
|
||||||
// NodeConfig stores configuration options for a node
|
// NodeConfig stores configuration options for a node
|
||||||
type NodeConfig struct {
|
type NodeConfig struct {
|
||||||
// DevMode is true when given configuration is to be used during development.
|
// DevMode is true when given configuration is to be used during development.
|
||||||
@ -163,6 +251,9 @@ type NodeConfig struct {
|
|||||||
// Pass empty string if no HTTP RPC interface needs to be started.
|
// Pass empty string if no HTTP RPC interface needs to be started.
|
||||||
HTTPHost string
|
HTTPHost string
|
||||||
|
|
||||||
|
// RPCEnabled specifies whether the http RPC server is to be enabled by default.
|
||||||
|
RPCEnabled bool
|
||||||
|
|
||||||
// HTTPPort is the TCP port number on which to start the Geth's HTTP RPC server.
|
// HTTPPort is the TCP port number on which to start the Geth's HTTP RPC server.
|
||||||
HTTPPort int
|
HTTPPort int
|
||||||
|
|
||||||
@ -226,6 +317,7 @@ func NewNodeConfig(dataDir string, networkID uint64, devMode bool) (*NodeConfig,
|
|||||||
DataDir: dataDir,
|
DataDir: dataDir,
|
||||||
Name: ClientIdentifier,
|
Name: ClientIdentifier,
|
||||||
Version: Version,
|
Version: Version,
|
||||||
|
RPCEnabled: RPCEnabledDefault,
|
||||||
HTTPHost: HTTPHost,
|
HTTPHost: HTTPHost,
|
||||||
HTTPPort: HTTPPort,
|
HTTPPort: HTTPPort,
|
||||||
WSHost: WSHost,
|
WSHost: WSHost,
|
||||||
@ -323,12 +415,14 @@ func (c *NodeConfig) LoadBootClusterNodes() ([]string, error) {
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
filename := c.BootClusterConfig.ConfigFile
|
filename := c.BootClusterConfig.ConfigFile
|
||||||
|
|
||||||
log.Info("Loading boot nodes config file", "source", filename)
|
log.Info("Loading boot nodes config file", "source", filename)
|
||||||
if _, err = os.Stat(filename); os.IsNotExist(err) { // load from static resources
|
if _, err = os.Stat(filename); os.IsNotExist(err) { // load from static resources
|
||||||
configData, err = static.Asset("bootcluster/" + filename)
|
configData, err = static.Asset("bootcluster/" + filename)
|
||||||
} else {
|
} else {
|
||||||
configData, err = ioutil.ReadFile(filename)
|
configData, err = ioutil.ReadFile(filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -387,6 +481,7 @@ func (c *NodeConfig) updateGenesisConfig() error {
|
|||||||
// updateBootClusterConfig populates cluster config file, depending on dev/prod and mobile/full settings
|
// updateBootClusterConfig populates cluster config file, depending on dev/prod and mobile/full settings
|
||||||
func (c *NodeConfig) updateBootClusterConfig() error {
|
func (c *NodeConfig) updateBootClusterConfig() error {
|
||||||
var configFile string
|
var configFile string
|
||||||
|
|
||||||
switch c.NetworkID {
|
switch c.NetworkID {
|
||||||
case MainNetworkID:
|
case MainNetworkID:
|
||||||
configFile = "homestead.prod.json"
|
configFile = "homestead.prod.json"
|
||||||
@ -395,9 +490,11 @@ func (c *NodeConfig) updateBootClusterConfig() error {
|
|||||||
case RinkebyNetworkID:
|
case RinkebyNetworkID:
|
||||||
configFile = "rinkeby.prod.json"
|
configFile = "rinkeby.prod.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.DevMode {
|
if c.DevMode {
|
||||||
configFile = strings.Replace(configFile, "prod", "dev", 1)
|
configFile = strings.Replace(configFile, "prod", "dev", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(configFile) > 0 {
|
if len(configFile) > 0 {
|
||||||
c.BootClusterConfig.ConfigFile = configFile
|
c.BootClusterConfig.ConfigFile = configFile
|
||||||
}
|
}
|
||||||
@ -408,6 +505,7 @@ func (c *NodeConfig) updateBootClusterConfig() error {
|
|||||||
// updateRPCConfig transforms RPC settings to meet requirements of a given configuration
|
// updateRPCConfig transforms RPC settings to meet requirements of a given configuration
|
||||||
func (c *NodeConfig) updateRPCConfig() error {
|
func (c *NodeConfig) updateRPCConfig() error {
|
||||||
c.APIModules = ProdAPIModules
|
c.APIModules = ProdAPIModules
|
||||||
|
|
||||||
if c.DevMode {
|
if c.DevMode {
|
||||||
c.APIModules = DevAPIModules
|
c.APIModules = DevAPIModules
|
||||||
}
|
}
|
||||||
@ -440,77 +538,3 @@ func (c *NodeConfig) String() string {
|
|||||||
data, _ := json.MarshalIndent(c, "", " ")
|
data, _ := json.MarshalIndent(c, "", " ")
|
||||||
return string(data)
|
return string(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// String dumps config object as nicely indented JSON
|
|
||||||
func (c *WhisperConfig) String() string {
|
|
||||||
data, _ := json.MarshalIndent(c, "", " ")
|
|
||||||
return string(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// String dumps config object as nicely indented JSON
|
|
||||||
func (c *SwarmConfig) String() string {
|
|
||||||
data, _ := json.MarshalIndent(c, "", " ")
|
|
||||||
return string(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// String dumps config object as nicely indented JSON
|
|
||||||
func (c *BootClusterConfig) String() string {
|
|
||||||
data, _ := json.MarshalIndent(c, "", " ")
|
|
||||||
return string(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadPasswordFile reads and returns content of the password file
|
|
||||||
func (c *WhisperConfig) ReadPasswordFile() ([]byte, error) {
|
|
||||||
if len(c.PasswordFile) <= 0 {
|
|
||||||
return nil, ErrEmptyPasswordFile
|
|
||||||
}
|
|
||||||
|
|
||||||
password, err := ioutil.ReadFile(c.PasswordFile)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
password = bytes.TrimRight(password, "\n")
|
|
||||||
|
|
||||||
if len(password) == 0 {
|
|
||||||
return nil, ErrEmptyPasswordFile
|
|
||||||
}
|
|
||||||
|
|
||||||
return password, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadIdentityFile reads and loads identity private key
|
|
||||||
func (c *WhisperConfig) ReadIdentityFile() (*ecdsa.PrivateKey, error) {
|
|
||||||
if len(c.IdentityFile) <= 0 {
|
|
||||||
return nil, ErrEmptyIdentityFile
|
|
||||||
}
|
|
||||||
|
|
||||||
identity, err := crypto.LoadECDSA(c.IdentityFile)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if identity == nil {
|
|
||||||
return nil, ErrEmptyIdentityFile
|
|
||||||
}
|
|
||||||
|
|
||||||
return identity, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadAuthorizationKeyFile reads and loads FCM authorization key
|
|
||||||
func (c *FirebaseConfig) ReadAuthorizationKeyFile() ([]byte, error) {
|
|
||||||
if len(c.AuthorizationKeyFile) <= 0 {
|
|
||||||
return nil, ErrEmptyAuthorizationKeyFile
|
|
||||||
}
|
|
||||||
|
|
||||||
key, err := ioutil.ReadFile(c.AuthorizationKeyFile)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
key = bytes.TrimRight(key, "\n")
|
|
||||||
|
|
||||||
if key == nil {
|
|
||||||
return nil, ErrEmptyAuthorizationKeyFile
|
|
||||||
}
|
|
||||||
|
|
||||||
return key, nil
|
|
||||||
}
|
|
||||||
|
@ -29,6 +29,7 @@ var loadConfigTestCases = []struct {
|
|||||||
"WSPort": 8546,
|
"WSPort": 8546,
|
||||||
"IPCEnabled": true,
|
"IPCEnabled": true,
|
||||||
"WSEnabled": false,
|
"WSEnabled": false,
|
||||||
|
"RPCEnabled": false,
|
||||||
"LightEthConfig": {
|
"LightEthConfig": {
|
||||||
"DatabaseCache": 64
|
"DatabaseCache": 64
|
||||||
}
|
}
|
||||||
@ -134,6 +135,7 @@ var loadConfigTestCases = []struct {
|
|||||||
"WSPort": 4242,
|
"WSPort": 4242,
|
||||||
"IPCEnabled": true,
|
"IPCEnabled": true,
|
||||||
"WSEnabled": false,
|
"WSEnabled": false,
|
||||||
|
"RPCEnabled": true,
|
||||||
"LightEthConfig": {
|
"LightEthConfig": {
|
||||||
"DatabaseCache": 64
|
"DatabaseCache": 64
|
||||||
}
|
}
|
||||||
@ -159,6 +161,10 @@ var loadConfigTestCases = []struct {
|
|||||||
t.Fatal("wrong HTTPHost")
|
t.Fatal("wrong HTTPHost")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !nodeConfig.RPCEnabled {
|
||||||
|
t.Fatal("Wrong RPCEnabled flag")
|
||||||
|
}
|
||||||
|
|
||||||
if nodeConfig.WSPort != 4242 {
|
if nodeConfig.WSPort != 4242 {
|
||||||
t.Fatal("wrong WSPort")
|
t.Fatal("wrong WSPort")
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@ const (
|
|||||||
// IPCFile is filename of exposed IPC RPC Server
|
// IPCFile is filename of exposed IPC RPC Server
|
||||||
IPCFile = "geth.ipc"
|
IPCFile = "geth.ipc"
|
||||||
|
|
||||||
|
// RPCEnabledDefault is the default state of whether the http rpc server is supposed
|
||||||
|
// to be started along with a node.
|
||||||
|
RPCEnabledDefault = false
|
||||||
|
|
||||||
// HTTPHost is host interface for the HTTP RPC server
|
// HTTPHost is host interface for the HTTP RPC server
|
||||||
HTTPHost = "localhost"
|
HTTPHost = "localhost"
|
||||||
|
|
||||||
|
1
geth/params/testdata/config.mainnet.json
vendored
1
geth/params/testdata/config.mainnet.json
vendored
@ -8,6 +8,7 @@
|
|||||||
"Version": "$VERSION",
|
"Version": "$VERSION",
|
||||||
"APIModules": "db,eth,net,web3,shh,personal,admin",
|
"APIModules": "db,eth,net,web3,shh,personal,admin",
|
||||||
"HTTPHost": "localhost",
|
"HTTPHost": "localhost",
|
||||||
|
"RPCEnabled": false,
|
||||||
"HTTPPort": 8545,
|
"HTTPPort": 8545,
|
||||||
"WSHost": "localhost",
|
"WSHost": "localhost",
|
||||||
"WSPort": 8546,
|
"WSPort": 8546,
|
||||||
|
1
geth/params/testdata/config.rinkeby.json
vendored
1
geth/params/testdata/config.rinkeby.json
vendored
@ -8,6 +8,7 @@
|
|||||||
"Version": "$VERSION",
|
"Version": "$VERSION",
|
||||||
"APIModules": "db,eth,net,web3,shh,personal,admin",
|
"APIModules": "db,eth,net,web3,shh,personal,admin",
|
||||||
"HTTPHost": "localhost",
|
"HTTPHost": "localhost",
|
||||||
|
"RPCEnabled": false,
|
||||||
"HTTPPort": 8545,
|
"HTTPPort": 8545,
|
||||||
"WSHost": "localhost",
|
"WSHost": "localhost",
|
||||||
"WSPort": 8546,
|
"WSPort": 8546,
|
||||||
|
1
geth/params/testdata/config.ropsten.json
vendored
1
geth/params/testdata/config.ropsten.json
vendored
@ -8,6 +8,7 @@
|
|||||||
"Version": "$VERSION",
|
"Version": "$VERSION",
|
||||||
"APIModules": "db,eth,net,web3,shh,personal,admin",
|
"APIModules": "db,eth,net,web3,shh,personal,admin",
|
||||||
"HTTPHost": "localhost",
|
"HTTPHost": "localhost",
|
||||||
|
"RPCEnabled": false,
|
||||||
"HTTPPort": 8545,
|
"HTTPPort": 8545,
|
||||||
"WSHost": "localhost",
|
"WSHost": "localhost",
|
||||||
"WSPort": 8546,
|
"WSPort": 8546,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user