diff options
Diffstat (limited to 'rpc/api/utils.go')
-rw-r--r-- | rpc/api/utils.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/rpc/api/utils.go b/rpc/api/utils.go index 8351e88d3..d6820cd2e 100644 --- a/rpc/api/utils.go +++ b/rpc/api/utils.go @@ -22,6 +22,7 @@ import ( "fmt" "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/shared" "github.com/ethereum/go-ethereum/xeth" @@ -154,7 +155,7 @@ var ( ) // Parse a comma separated API string to individual api's -func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth.Ethereum) ([]shared.EthereumApi, error) { +func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, stack *node.Node) ([]shared.EthereumApi, error) { if len(strings.TrimSpace(apistr)) == 0 { return nil, fmt.Errorf("Empty apistr provided") } @@ -162,10 +163,16 @@ func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth. names := strings.Split(apistr, ",") apis := make([]shared.EthereumApi, len(names)) + var eth *eth.Ethereum + if stack != nil { + if err := stack.Service(ð); err != nil { + return nil, err + } + } for i, name := range names { switch strings.ToLower(strings.TrimSpace(name)) { case shared.AdminApiName: - apis[i] = NewAdminApi(xeth, eth, codec) + apis[i] = NewAdminApi(xeth, stack, codec) case shared.DebugApiName: apis[i] = NewDebugApi(xeth, eth, codec) case shared.DbApiName: @@ -188,7 +195,6 @@ func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth. return nil, fmt.Errorf("Unknown API '%s'", name) } } - return apis, nil } |