remove p2p from api

This commit is contained in:
vsmk98 2018-11-14 18:03:50 +08:00
parent 7c94184803
commit 405204cd23
2 changed files with 3 additions and 6 deletions

View File

@ -389,6 +389,6 @@ func startQuorumPermissionService(ctx *cli.Context, stack *node.Node) {
utils.Fatalf("Failed to attach to self: %v", err)
}
stateReader := ethclient.NewClient(rpcClient)
qapi.Init(stateReader, stack.Server(), stack.GetNodeKey())
qapi.Init(stateReader, stack.GetNodeKey())
log.Info("Permission API initialized")
}

View File

@ -15,7 +15,6 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/params"
)
@ -59,7 +58,6 @@ type PermissionAPI struct {
txOpt *bind.TransactOpts
permContr *pbind.Permissions
clustContr *pbind.Cluster
server *p2p.Server
key *ecdsa.PrivateKey
}
@ -86,7 +84,7 @@ type ExecStatus struct {
// NewPermissionAPI creates a new PermissionAPI to access quorum services
func NewPermissionAPI(tp *core.TxPool, am *accounts.Manager) *PermissionAPI {
return &PermissionAPI{tp, nil, am, nil, nil, nil, nil, nil}
return &PermissionAPI{tp, nil, am, nil, nil, nil, nil}
}
// helper function decodes the node status to string
@ -116,7 +114,7 @@ func decodeNodeStatus(nodeStatus uint8) string {
}
//Init initializes PermissionAPI with eth client, permission contract and org key management control
func (p *PermissionAPI) Init(ethClnt *ethclient.Client, srv *p2p.Server, key *ecdsa.PrivateKey) error {
func (p *PermissionAPI) Init(ethClnt *ethclient.Client, key *ecdsa.PrivateKey) error {
p.ethClnt = ethClnt
permContr, err := pbind.NewPermissions(params.QuorumPermissionsContract, p.ethClnt)
if err != nil {
@ -128,7 +126,6 @@ func (p *PermissionAPI) Init(ethClnt *ethclient.Client, srv *p2p.Server, key *ec
return err
}
p.clustContr = clustContr
p.server = srv
p.key = key
// p.PermissionNodeList()
return nil