Skip to content

Commit 9869827

Browse files
committed
remove support for external miner
1 parent 92ab504 commit 9869827

File tree

8 files changed

+4
-87
lines changed

8 files changed

+4
-87
lines changed

common/config/producer.go

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ type Producer struct {
1313
Coinbase string `json:"Coinbase"`
1414
EntropyStorePath string `json:"EntropyStorePath"`
1515

16-
ExternalMiner bool `json:"externalMiner"`
17-
1816
coinbase types.Address
1917
index uint32
2018
}

conf/evm/node_config.json

-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
"util",
1919
"debug",
2020
"sbpstats",
21-
"miner",
2221
"wallet"
2322
],
2423
"Miner": true,
25-
"ExternalMiner": true,
2624
"CoinBase": "0:vite_3167c9421c8a4cb642d613082dfcef932e26063867f277ec0f",
2725
"EntropyStorePath": "/root/conf/evm/vite_3167c9421c8a4cb642d613082dfcef932e26063867f277ec0f",
2826
"EntropyStorePassword": "123456",

ledger/consensus/config.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package consensus
22

33
type ConsensusCfg struct {
4-
EnablePuppet bool
54
}
65

76
func DefaultCfg() *ConsensusCfg {
8-
return &ConsensusCfg{
9-
EnablePuppet: false,
10-
}
7+
return &ConsensusCfg{}
118
}
129

13-
func Cfg(enablePuppet bool) *ConsensusCfg {
14-
return &ConsensusCfg{EnablePuppet: enablePuppet}
10+
func Cfg() *ConsensusCfg {
11+
return &ConsensusCfg{}
1512
}

ledger/consensus/consensus_impl.go

-9
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import (
1212
)
1313

1414
func (cs *consensus) VerifySnapshotProducer(header *ledger.SnapshotBlock) (bool, error) {
15-
if cs.EnablePuppet {
16-
return true, nil
17-
}
1815
cs.snapshot.verifyProducerAndSeed(header)
1916
return cs.snapshot.VerifyProducer(header.Producer(), *header.Timestamp)
2017
}
@@ -116,12 +113,6 @@ func (cs *consensus) Init(cfg *ConsensusCfg) error {
116113
cs.rw.init(snapshot)
117114

118115
cs.tg = newTrigger(cs.rollback)
119-
if cfg.EnablePuppet {
120-
sub := newSubscriberPuppet(cs.Subscriber, cs.snapshot)
121-
cs.Subscriber = sub
122-
cs.subscribeTrigger = sub
123-
}
124-
125116
cs.contracts = newContractCs(cs.rw, cs.mLog)
126117
err := cs.contracts.LoadGid(types.DELEGATE_GID)
127118

ledger/consensus/subscriber_puppet.go

-58
This file was deleted.

node/config/config.go

-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ type Config struct {
6363
EntropyStorePassword string `json:"EntropyStorePassword"`
6464
CoinBase string `json:"CoinBase"`
6565
MinerEnabled bool `json:"Miner"`
66-
ExternalMiner bool `json:"ExternalMiner"`
6766

6867
//rpc
6968
RPCEnabled bool `json:"RPCEnabled"`
@@ -193,7 +192,6 @@ func (c *Config) MakeMinerConfig() *config.Producer {
193192
Producer: c.MinerEnabled,
194193
Coinbase: c.CoinBase,
195194
EntropyStorePath: c.EntropyStorePath,
196-
ExternalMiner: c.ExternalMiner,
197195
}
198196
err := cfg.Parse()
199197
if err != nil {

rpcapi/api/virtual.go

-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package api
22

33
import (
44
"errors"
5-
"fmt"
65

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

3130
func (api *VirtualApi) Mine() error {
32-
if !api.vite.Config().IsMine() {
33-
return fmt.Errorf("should enable mine")
34-
}
35-
if !api.vite.Config().ExternalMiner {
36-
return fmt.Errorf("should enable external miner")
37-
}
3831
return api.vite.Producer().SnapshotOnce()
3932
}
4033

vite.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (v *Vite) Start() (err error) {
124124

125125
v.chain.Start()
126126

127-
err = v.consensus.Init(consensus.Cfg(v.Config().Producer.ExternalMiner))
127+
err = v.consensus.Init(consensus.Cfg())
128128
if err != nil {
129129
return err
130130
}

0 commit comments

Comments
 (0)