Fixed bug too many open IPC connect at same time.

This commit is contained in:
MestryOmkar 2018-09-15 18:29:07 +05:30
parent 725930f310
commit 3584bcfa5f

View file

@ -205,15 +205,15 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
endBlockNumber := startBlockNumber + rCheckpoint - 1 endBlockNumber := startBlockNumber + rCheckpoint - 1
signers := make(map[common.Address]*rewardLog) signers := make(map[common.Address]*rewardLog)
totalSigner := uint64(0) totalSigner := uint64(0)
for i := startBlockNumber; i <= endBlockNumber; i++ {
// Get signers in blockSigner smartcontract. // Get signers in blockSigner smartcontract.
client, err := contracts.GetEthClient(ctx) client, err := contracts.GetEthClient(ctx)
if err != nil { if err != nil {
log.Error("Fail to connect IPC from blockSigner", "error", err) log.Error("Fail to connect IPC from blockSigner", "error", err)
return err return err
} }
addrs, err := contracts.GetSignersFromContract(client, i
for i := startBlockNumber; i <= endBlockNumber; i++ {
addrs, err := contracts.GetSignersFromContract(client, i)
if err != nil { if err != nil {
log.Error("Fail to get signers from smartcontract.", "error", err, "blockNumber", i) log.Error("Fail to get signers from smartcontract.", "error", err, "blockNumber", i)
return err return err
@ -420,7 +420,7 @@ func (self *Ethereum) SetEtherbase(etherbase common.Address) {
} }
// ValidateMiner checks if node's address is in set of validators // ValidateMiner checks if node's address is in set of validators
func (s *Ethereum) ValidateMiner() (bool, error) { func (s *Ethereum) ValidateStaker() (bool, error) {
eb, err := s.Etherbase() eb, err := s.Etherbase()
if err != nil { if err != nil {
return false, err return false, err
@ -442,7 +442,7 @@ func (s *Ethereum) ValidateMiner() (bool, error) {
return true, nil return true, nil
} }
func (s *Ethereum) StartMining(local bool) error { func (s *Ethereum) StartStaking(local bool) error {
eb, err := s.Etherbase() eb, err := s.Etherbase()
if err != nil { if err != nil {
log.Error("Cannot start mining without etherbase", "err", err) log.Error("Cannot start mining without etherbase", "err", err)