handling null pointer error for voter list when network brought in non permissioned mode

This commit is contained in:
vsmk98 2018-11-20 22:51:49 +08:00
parent 939142786e
commit 5b34cb7eee
2 changed files with 6 additions and 1 deletions

View File

@ -443,7 +443,7 @@ func (p *PermissionCtrl) populateInitPermission() error {
if tx && !p.permissionedMode {
// Network is initialized with permissions and node is joining in a non-permissioned
// option. stop the node from coming up
utils.Fatalf("Joining a permissioned network in non-permissioned mode. Bring up get with --permissioned.")
utils.Fatalf("Joining a permissioned network in non-permissioned mode. Bring up geth with --permissioned.")
}
if !p.permissionedMode {

View File

@ -219,6 +219,11 @@ func (s *PermissionAPI) PermissionAccountList() []accountInfo {
}
func (s *PermissionAPI) VoterList() []string {
if !s.enabled {
voterArr := make([]string, 1)
voterArr[0] = "Permissions control not enabled for the network"
return voterArr
}
ps := s.newPermSessionWithNodeKeySigner()
// get the total number of accounts with permissions
voterCnt, err := ps.GetNumberOfVoters()