Skip to content

Commit

Permalink
remove support for external miner
Browse files Browse the repository at this point in the history
  • Loading branch information
viteshan committed May 30, 2022
1 parent 92ab504 commit 9869827
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 87 deletions.
2 changes: 0 additions & 2 deletions common/config/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ type Producer struct {
Coinbase string `json:"Coinbase"`
EntropyStorePath string `json:"EntropyStorePath"`

ExternalMiner bool `json:"externalMiner"`

coinbase types.Address
index uint32
}
Expand Down
2 changes: 0 additions & 2 deletions conf/evm/node_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
"util",
"debug",
"sbpstats",
"miner",
"wallet"
],
"Miner": true,
"ExternalMiner": true,
"CoinBase": "0:vite_3167c9421c8a4cb642d613082dfcef932e26063867f277ec0f",
"EntropyStorePath": "/root/conf/evm/vite_3167c9421c8a4cb642d613082dfcef932e26063867f277ec0f",
"EntropyStorePassword": "123456",
Expand Down
9 changes: 3 additions & 6 deletions ledger/consensus/config.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package consensus

type ConsensusCfg struct {
EnablePuppet bool
}

func DefaultCfg() *ConsensusCfg {
return &ConsensusCfg{
EnablePuppet: false,
}
return &ConsensusCfg{}
}

func Cfg(enablePuppet bool) *ConsensusCfg {
return &ConsensusCfg{EnablePuppet: enablePuppet}
func Cfg() *ConsensusCfg {
return &ConsensusCfg{}
}
9 changes: 0 additions & 9 deletions ledger/consensus/consensus_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import (
)

func (cs *consensus) VerifySnapshotProducer(header *ledger.SnapshotBlock) (bool, error) {
if cs.EnablePuppet {
return true, nil
}
cs.snapshot.verifyProducerAndSeed(header)
return cs.snapshot.VerifyProducer(header.Producer(), *header.Timestamp)
}
Expand Down Expand Up @@ -116,12 +113,6 @@ func (cs *consensus) Init(cfg *ConsensusCfg) error {
cs.rw.init(snapshot)

cs.tg = newTrigger(cs.rollback)
if cfg.EnablePuppet {
sub := newSubscriberPuppet(cs.Subscriber, cs.snapshot)
cs.Subscriber = sub
cs.subscribeTrigger = sub
}

cs.contracts = newContractCs(cs.rw, cs.mLog)
err := cs.contracts.LoadGid(types.DELEGATE_GID)

Expand Down
58 changes: 0 additions & 58 deletions ledger/consensus/subscriber_puppet.go

This file was deleted.

2 changes: 0 additions & 2 deletions node/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ type Config struct {
EntropyStorePassword string `json:"EntropyStorePassword"`
CoinBase string `json:"CoinBase"`
MinerEnabled bool `json:"Miner"`
ExternalMiner bool `json:"ExternalMiner"`

//rpc
RPCEnabled bool `json:"RPCEnabled"`
Expand Down Expand Up @@ -193,7 +192,6 @@ func (c *Config) MakeMinerConfig() *config.Producer {
Producer: c.MinerEnabled,
Coinbase: c.CoinBase,
EntropyStorePath: c.EntropyStorePath,
ExternalMiner: c.ExternalMiner,
}
err := cfg.Parse()
if err != nil {
Expand Down
7 changes: 0 additions & 7 deletions rpcapi/api/virtual.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package api

import (
"errors"
"fmt"

"github.com/vitelabs/go-vite/v2"
"github.com/vitelabs/go-vite/v2/common/upgrade"
Expand All @@ -29,12 +28,6 @@ func (api VirtualApi) String() string {
}

func (api *VirtualApi) Mine() error {
if !api.vite.Config().IsMine() {
return fmt.Errorf("should enable mine")
}
if !api.vite.Config().ExternalMiner {
return fmt.Errorf("should enable external miner")
}
return api.vite.Producer().SnapshotOnce()
}

Expand Down
2 changes: 1 addition & 1 deletion vite.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (v *Vite) Start() (err error) {

v.chain.Start()

err = v.consensus.Init(consensus.Cfg(v.Config().Producer.ExternalMiner))
err = v.consensus.Init(consensus.Cfg())
if err != nil {
return err
}
Expand Down

0 comments on commit 9869827

Please sign in to comment.