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
signers := make(map[common.Address]*rewardLog)
totalSigner := uint64(0)
// Get signers in blockSigner smartcontract.
client, err := contracts.GetEthClient(ctx)
if err != nil {
log.Error("Fail to connect IPC from blockSigner", "error", err)
return err
}
for i := startBlockNumber; i <= endBlockNumber; i++ {
// Get signers in blockSigner smartcontract.
client, err := contracts.GetEthClient(ctx)
if err != nil {
log.Error("Fail to connect IPC from blockSigner", "error", err)
return err
}
addrs, err := contracts.GetSignersFromContract(client, i
addrs, err := contracts.GetSignersFromContract(client, i)
if err != nil {
log.Error("Fail to get signers from smartcontract.", "error", err, "blockNumber", i)
return err
@ -420,7 +420,7 @@ func (self *Ethereum) SetEtherbase(etherbase common.Address) {
}
// 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()
if err != nil {
return false, err
@ -442,7 +442,7 @@ func (s *Ethereum) ValidateMiner() (bool, error) {
return true, nil
}
func (s *Ethereum) StartMining(local bool) error {
func (s *Ethereum) StartStaking(local bool) error {
eb, err := s.Etherbase()
if err != nil {
log.Error("Cannot start mining without etherbase", "err", err)