mirror of https://github.com/poanetwork/quorum.git
Added check to ensure that at least one account is given as a part of genesis.json for initial network to come up
This commit is contained in:
parent
178d7629c4
commit
1f527f7b3b
File diff suppressed because one or more lines are too long
|
@ -101,25 +101,29 @@ contract Permissions {
|
|||
/* public and external functions */
|
||||
// view functions
|
||||
|
||||
// get number of accounts in the init list given as per genesis.json
|
||||
function getInitAccountsCount() external view returns (uint){
|
||||
return initialAcctList.length;
|
||||
}
|
||||
// Get number of voters
|
||||
function getNumberOfVoters() public view returns (uint)
|
||||
function getNumberOfVoters() external view returns (uint)
|
||||
{
|
||||
return numberOfVoters;
|
||||
}
|
||||
|
||||
// Get number of valid voters
|
||||
function getNumberOfValidVoters() public view returns (uint)
|
||||
function getNumberOfValidVoters() external view returns (uint)
|
||||
{
|
||||
return numberOfValidVoters;
|
||||
}
|
||||
// Get voter
|
||||
function getVoter(uint i) public view returns (address _addr, VoterStatus _voterStatus)
|
||||
function getVoter(uint i) external view returns (address _addr, VoterStatus _voterStatus)
|
||||
{
|
||||
return (voterAcctList[i].voterAcct, voterAcctList[i].voterStatus);
|
||||
}
|
||||
|
||||
// Get number of nodes
|
||||
function getNetworkBootStatus() public view returns (bool)
|
||||
function getNetworkBootStatus() external view returns (bool)
|
||||
{
|
||||
return networkBoot;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -443,7 +443,6 @@ func (p *PermissionCtrl) populateInitPermission() error {
|
|||
GasPrice: big.NewInt(0),
|
||||
},
|
||||
}
|
||||
|
||||
tx, err := permissionsSession.GetNetworkBootStatus()
|
||||
if err != nil {
|
||||
// handle the scenario of no contract code.
|
||||
|
@ -463,6 +462,15 @@ func (p *PermissionCtrl) populateInitPermission() error {
|
|||
return errors.New("Node started in non-permissioned mode")
|
||||
}
|
||||
if tx != true {
|
||||
// Ensure that there is at least one account given as a part of genesis.json
|
||||
// which will have full access. If not throw a fatal error
|
||||
// Do not want a network with no access
|
||||
initAcctCnt, err := permissionsSession.GetInitAccountsCount()
|
||||
|
||||
log.Info("SMK-populateInitPermission @471 ", "err", err, "initAcctCnt", initAcctCnt)
|
||||
if err == nil && initAcctCnt.Cmp(big.NewInt(0)) == 0 {
|
||||
utils.Fatalf("Permissioned network being brought up with zero accounts having full access. Add accounts as a part of genesis.json and bring up the network")
|
||||
}
|
||||
// populate initial account access to full access
|
||||
err = p.populateInitAccountAccess(permissionsSession)
|
||||
if err != nil {
|
||||
|
@ -470,7 +478,7 @@ func (p *PermissionCtrl) populateInitPermission() error {
|
|||
}
|
||||
|
||||
// populate the initial node list from static-nodes.json
|
||||
err := p.populateStaticNodesToContract(permissionsSession)
|
||||
err = p.populateStaticNodesToContract(permissionsSession)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue