Skip to content

Commit

Permalink
Merge branch 'master' into merge-v1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-Wilson authored Aug 10, 2023
2 parents c0e2e97 + 0461acc commit 0685207
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
8 changes: 4 additions & 4 deletions ethdb/memorydb/memorydb.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ var (
// invocation of a data access operation.
errMemorydbClosed = errors.New("database closed")

// errMemorydbNotFound is returned if a key is requested that is not found in
// ErrMemorydbNotFound is returned if a key is requested that is not found in
// the provided memory database.
errMemorydbNotFound = errors.New("not found")
ErrMemorydbNotFound = errors.New("not found")

// errSnapshotReleased is returned if callers want to retrieve data from a
// released snapshot.
Expand Down Expand Up @@ -98,7 +98,7 @@ func (db *Database) Get(key []byte) ([]byte, error) {
if entry, ok := db.db[string(key)]; ok {
return common.CopyBytes(entry), nil
}
return nil, errMemorydbNotFound
return nil, ErrMemorydbNotFound
}

// Put inserts the given value into the key-value store.
Expand Down Expand Up @@ -377,7 +377,7 @@ func (snap *snapshot) Get(key []byte) ([]byte, error) {
if entry, ok := snap.db[string(key)]; ok {
return common.CopyBytes(entry), nil
}
return nil, errMemorydbNotFound
return nil, ErrMemorydbNotFound
}

// Release releases associated resources. Release should always succeed and can
Expand Down
10 changes: 10 additions & 0 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ type Config struct {
// for the authenticated api. This is by default {'localhost'}.
AuthVirtualHosts []string `toml:",omitempty"`

// AuthModules is a list of API modules to expose via the Auth RPC interface.
// If the module list is empty, all RPC API endpoints designated public will be
// exposed.
AuthModules []string

// AuthOrigins is the list of domain to accept websocket requests from. Please be
// aware that the server can only act upon the HTTP request the client sends and
// cannot verify the validity of the request header.
AuthOrigins []string `toml:",omitempty"`

// WSHost is the host interface on which to start the websocket RPC server. If
// this field is empty, no websocket API endpoint will be started.
WSHost string
Expand Down
2 changes: 2 additions & 0 deletions node/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ var DefaultConfig = Config{
AuthAddr: DefaultAuthHost,
AuthPort: DefaultAuthPort,
AuthVirtualHosts: DefaultAuthVhosts,
AuthModules: DefaultAuthModules,
AuthOrigins: DefaultAuthOrigins,
HTTPModules: []string{"net", "web3"},
HTTPVirtualHosts: []string{"localhost"},
HTTPTimeouts: rpc.DefaultHTTPTimeouts,
Expand Down
6 changes: 3 additions & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (n *Node) startRPC() error {
if err := server.enableRPC(allAPIs, httpConfig{
CorsAllowedOrigins: DefaultAuthCors,
Vhosts: n.config.AuthVirtualHosts,
Modules: DefaultAuthModules,
Modules: n.config.AuthModules,
prefix: DefaultAuthPrefix,
jwtSecret: secret,
}); err != nil {
Expand All @@ -463,8 +463,8 @@ func (n *Node) startRPC() error {
return err
}
if err := server.enableWS(allAPIs, wsConfig{
Modules: DefaultAuthModules,
Origins: DefaultAuthOrigins,
Modules: n.config.AuthModules,
Origins: n.config.AuthOrigins,
prefix: DefaultAuthPrefix,
jwtSecret: secret,
}); err != nil {
Expand Down

0 comments on commit 0685207

Please sign in to comment.