staking instead of mining

This commit is contained in:
MestryOmkar 2018-08-12 14:41:12 +05:30
parent bbd132c1a3
commit eb8922c652
3 changed files with 11 additions and 11 deletions

View file

@ -291,7 +291,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
}
go func() {
started := false
ok, err := ethereum.ValidateMiner()
ok, err := ethereum.ValidateStaker()
if err != nil {
utils.Fatalf("Can't verify validator permission: %v", err)
}
@ -308,8 +308,8 @@ func startNode(ctx *cli.Context, stack *node.Node) {
}
// Set the gas price to the limits from the CLI and start mining
ethereum.TxPool().SetGasPrice(utils.GlobalBig(ctx, utils.GasPriceFlag.Name))
if err := ethereum.StartMining(true); err != nil {
utils.Fatalf("Failed to start mining: %v", err)
if err := ethereum.StartStaking(true); err != nil {
utils.Fatalf("Failed to start staking: %v", err)
}
started = true
log.Info("Enabled mining node!!!")
@ -318,7 +318,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
for range core.Checkpoint {
log.Info("Checkpoint!!! It's time to reconcile node's state...")
ok, err := ethereum.ValidateMiner()
ok, err := ethereum.ValidateStaker()
if err != nil {
utils.Fatalf("Can't verify validator permission: %v", err)
}
@ -342,7 +342,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
}
// Set the gas price to the limits from the CLI and start mining
ethereum.TxPool().SetGasPrice(utils.GlobalBig(ctx, utils.GasPriceFlag.Name))
if err := ethereum.StartMining(true); err != nil {
if err := ethereum.StartStaking(true); err != nil {
utils.Fatalf("Failed to start mining: %v", err)
}
started = true

View file

@ -96,7 +96,7 @@ func (api *PublicMinerAPI) SubmitWork(nonce types.BlockNonce, solution, digest c
// result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
func (api *PublicMinerAPI) GetWork() ([3]string, error) {
if !api.e.IsMining() {
if err := api.e.StartMining(false); err != nil {
if err := api.e.StartStaking(false); err != nil {
return [3]string{}, err
}
}
@ -152,7 +152,7 @@ func (api *PrivateMinerAPI) Start(threads *int) error {
api.e.lock.RUnlock()
api.e.txPool.SetGasPrice(price)
return api.e.StartMining(true)
return api.e.StartStaking(true)
}
return nil
}
@ -483,4 +483,4 @@ func (api *PrivateDebugAPI) getModifiedAccounts(startBlock, endBlock *types.Bloc
dirty = append(dirty, common.BytesToAddress(key))
}
return dirty, nil
}
}

View file

@ -441,8 +441,8 @@ func (self *Ethereum) SetEtherbase(etherbase common.Address) {
self.miner.SetEtherbase(etherbase)
}
// ValidateMiner checks if node's address is in set of validators
func (s *Ethereum) ValidateMiner() (bool, error) {
// ValidateStaker checks if node's address is in set of validators
func (s *Ethereum) ValidateStaker() (bool, error) {
eb, err := s.Etherbase()
if err != nil {
return false, err
@ -464,7 +464,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)