aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/vm.go
diff options
context:
space:
mode:
authorStephen Buttolph <[email protected]>2020-10-30 17:29:21 -0400
committerGitHub <[email protected]>2020-10-30 17:29:21 -0400
commitc613e21ea107e8369926f4b53b7830a9d5dabf18 (patch)
tree7fbd50b5628c6f687d7c5e68886b8f39fa135481 /plugin/evm/vm.go
parent806d04e9aa4b6e22fc2a484ada6fecb0c9a348e3 (diff)
parenta6ffdbbdd269fae35c5600e954bd373b619fe733 (diff)
Merge pull request #45 from ava-labs/handle-config
Parse config to set enabled APIs
Diffstat (limited to 'plugin/evm/vm.go')
-rw-r--r--plugin/evm/vm.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index c429bca..c902f85 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"math/big"
+ "strings"
"sync"
"sync/atomic"
"time"
@@ -231,6 +232,10 @@ func (vm *VM) Initialize(
toEngine chan<- commonEng.Message,
fxs []*commonEng.Fx,
) error {
+ if vm.CLIConfig.ParsingError != nil {
+ return vm.CLIConfig.ParsingError
+ }
+
if len(fxs) > 0 {
return errUnsupportedFXs
}
@@ -514,17 +519,23 @@ func newHandler(name string, service interface{}, lockOption ...commonEng.LockOp
// CreateHandlers makes new http handlers that can handle API calls
func (vm *VM) CreateHandlers() map[string]*commonEng.HTTPHandler {
handler := vm.chain.NewRPCHandler()
+ enabledAPIs := vm.CLIConfig.EthAPIs()
vm.chain.AttachEthService(handler, vm.CLIConfig.EthAPIs())
if vm.CLIConfig.SnowmanAPIEnabled {
handler.RegisterName("snowman", &SnowmanAPI{vm})
- }
- if vm.CLIConfig.Web3APIEnabled {
- handler.RegisterName("web3", &Web3API{})
+ enabledAPIs = append(enabledAPIs, "snowman")
}
if vm.CLIConfig.CorethAdminAPIEnabled {
handler.RegisterName("admin", &admin.Performance{})
+ enabledAPIs = append(enabledAPIs, "coreth-admin")
}
+ if vm.CLIConfig.NetAPIEnabled {
+ handler.RegisterName("net", &NetAPI{vm})
+ enabledAPIs = append(enabledAPIs, "net")
+ }
+
+ log.Info(fmt.Sprintf("Enabled APIs: %s", strings.Join(enabledAPIs, ", ")))
return map[string]*commonEng.HTTPHandler{
"/rpc": {LockOptions: commonEng.NoLock, Handler: handler},