mirror of https://github.com/poanetwork/quorum.git
format code
This commit is contained in:
parent
405204cd23
commit
9628cb5e2b
|
@ -362,7 +362,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
|||
|
||||
func startQuorumPermissionService(ctx *cli.Context, stack *node.Node) {
|
||||
// start the permissions management service
|
||||
pc, err := permission.NewQuorumPermissionCtrl(stack, ctx.GlobalBool(utils.EnableNodePermissionFlag.Name),ctx.GlobalBool(utils.RaftModeFlag.Name))
|
||||
pc, err := permission.NewQuorumPermissionCtrl(stack, ctx.GlobalBool(utils.EnableNodePermissionFlag.Name), ctx.GlobalBool(utils.RaftModeFlag.Name))
|
||||
if err != nil {
|
||||
utils.Fatalf("Failed to start Quorum Permission contract service: %v", err)
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package permission
|
|||
import (
|
||||
"crypto/ecdsa"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"os"
|
||||
|
@ -345,7 +345,7 @@ func (p *PermissionCtrl) populateAcctPermissions() error {
|
|||
for recExists {
|
||||
recExists = pastEvents.Next()
|
||||
if recExists {
|
||||
log.Info("SMK-populateAcctPermissions @344 ", "Account", pastEvents.Event.Address, "access",pastEvents.Event.Access)
|
||||
log.Info("SMK-populateAcctPermissions @344 ", "Account", pastEvents.Event.Address, "access", pastEvents.Event.Access)
|
||||
types.AddAccountAccess(pastEvents.Event.Address, pastEvents.Event.Access)
|
||||
}
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ func (p *PermissionCtrl) populateInitPermission() error {
|
|||
log.Info("SMK-populateInitPermission @447")
|
||||
}
|
||||
|
||||
if !p.permissionedMode{
|
||||
if !p.permissionedMode {
|
||||
return errors.New("Node started in non-permissioned mode")
|
||||
log.Info("SMK-populateInitPermission @452")
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ func NewPermissionAPI(tp *core.TxPool, am *accounts.Manager) *PermissionAPI {
|
|||
// helper function decodes the node status to string
|
||||
func decodeNodeStatus(nodeStatus uint8) string {
|
||||
var status string
|
||||
switch nodeStatus{
|
||||
switch nodeStatus {
|
||||
case 0:
|
||||
status = "Unknown"
|
||||
case 1:
|
||||
|
@ -153,9 +153,9 @@ func (s *PermissionAPI) PermissionNodeList() []nodeStatus {
|
|||
// loop for each index and get the node details from the contract
|
||||
if err == nil {
|
||||
i := int64(0)
|
||||
for nodeCnt.Cmp(big.NewInt(i)) > 0{
|
||||
for nodeCnt.Cmp(big.NewInt(i)) > 0 {
|
||||
nodeDtls, _ := ps.GetNodeDetails(big.NewInt(i))
|
||||
nodeStatArr[i].Name = "enode://"+ nodeDtls.EnodeId + "@" +nodeDtls.IpAddrPort
|
||||
nodeStatArr[i].Name = "enode://" + nodeDtls.EnodeId + "@" + nodeDtls.IpAddrPort
|
||||
nodeStatArr[i].Name += "?discport=" + nodeDtls.DiscPort
|
||||
if len(nodeDtls.RaftPort) > 0 {
|
||||
nodeStatArr[i].Name += "&raftport" + nodeDtls.RaftPort
|
||||
|
@ -254,7 +254,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
tx, err = ps.RemoveVoter(args.voter)
|
||||
|
||||
case ProposeNode:
|
||||
if !checkVoterExists(ps){
|
||||
if !checkVoterExists(ps) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -272,7 +272,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
tx, err = ps.ProposeNode(enodeID, ipAddrPort, discPort, raftPort)
|
||||
|
||||
case ApproveNode:
|
||||
if !checkIsVoter(ps, args.txa.From){
|
||||
if !checkIsVoter(ps, args.txa.From) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -284,7 +284,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
tx, err = ps.ApproveNode(enodeID)
|
||||
|
||||
case ProposeNodeDeactivation:
|
||||
if !checkVoterExists(ps){
|
||||
if !checkVoterExists(ps) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -296,7 +296,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
tx, err = ps.ProposeDeactivation(enodeID)
|
||||
|
||||
case ApproveNodeDeactivation:
|
||||
if !checkIsVoter(ps, args.txa.From){
|
||||
if !checkIsVoter(ps, args.txa.From) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -308,7 +308,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
tx, err = ps.DeactivateNode(enodeID)
|
||||
|
||||
case ProposeNodeActivation:
|
||||
if !checkVoterExists(ps){
|
||||
if !checkVoterExists(ps) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -320,7 +320,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
tx, err = ps.ProposeNodeActivation(enodeID)
|
||||
|
||||
case ApproveNodeActivation:
|
||||
if !checkIsVoter(ps, args.txa.From){
|
||||
if !checkIsVoter(ps, args.txa.From) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -332,7 +332,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
tx, err = ps.ActivateNode(enodeID)
|
||||
|
||||
case ProposeNodeBlacklisting:
|
||||
if !checkVoterExists(ps){
|
||||
if !checkVoterExists(ps) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -349,7 +349,7 @@ func (s *PermissionAPI) executePermAction(action PermAction, args txArgs) ExecSt
|
|||
|
||||
tx, err = ps.ProposeNodeBlacklisting(enodeID, ipAddrPort, discPort, raftPort)
|
||||
case ApproveNodeBlacklisting:
|
||||
if !checkIsVoter(ps, args.txa.From){
|
||||
if !checkIsVoter(ps, args.txa.From) {
|
||||
return voterErr
|
||||
}
|
||||
node, err = discover.ParseNode(args.nodeId)
|
||||
|
@ -428,6 +428,7 @@ func checkIsVoter(ps *pbind.PermissionsSession, acctId common.Address) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// newPermSession creates a new permission contract session
|
||||
func (s *PermissionAPI) newPermSession(w accounts.Wallet, txa ethapi.SendTxArgs) *pbind.PermissionsSession {
|
||||
frmAcct, transactOpts, gasLimit, gasPrice, nonce := s.getTxParams(txa, w)
|
||||
|
|
|
@ -23,6 +23,7 @@ type OrgStruct struct {
|
|||
OrgId string
|
||||
Keys []string
|
||||
}
|
||||
|
||||
var DefaultAccess = FullAccess
|
||||
|
||||
const acctMapLimit = 100
|
||||
|
|
Loading…
Reference in New Issue