cmd, common, core, eth, node, rpc, tests, whisper, xeth: use protocol stacks
This commit is contained in:
@ -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.SingletonService(ð); 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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user