Skip to content

Commit

Permalink
fix: noneSnapshotVerifier -> virtualSnapshotVerifier
Browse files Browse the repository at this point in the history
  • Loading branch information
viteshan committed Jun 6, 2022
1 parent d2f5f75 commit 5dfa38b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/subcmd_virtualnode/virtual_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func startVirtualNode(ctx *cli.Context) error {
}

func virtualConsensusVerifier(cfg *config.Config) {
cfg.Producer.NoneSnapshotVerifier = true
cfg.Producer.VirtualSnapshotVerifier = true
}

func virtualApi(cfg *nodeconfig.Config) {
Expand Down
2 changes: 1 addition & 1 deletion common/config/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Producer struct {
coinbase types.Address
index uint32

NoneSnapshotVerifier bool `json:"NoneSnapshotVerifier"`
VirtualSnapshotVerifier bool `json:"VirtualSnapshotVerifier"`
}

func (cfg *Producer) IsMine() bool {
Expand Down
12 changes: 6 additions & 6 deletions ledger/consensus/consensus_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ import (
core "github.com/vitelabs/go-vite/v2/interfaces/core"
)

type noneVerifier struct {
type virtualVerifier struct {
}

func NewNoneVerifier() interfaces.ConsensusVerifier {
return &noneVerifier{}
func NewVirtualVerifier() interfaces.ConsensusVerifier {
return &virtualVerifier{}
}

func (noneVerifier) VerifyAccountProducer(block *core.AccountBlock) (bool, error) {
func (virtualVerifier) VerifyAccountProducer(block *core.AccountBlock) (bool, error) {
return true, nil
}

func (noneVerifier) VerifyABsProducer(abs map[types.Gid][]*core.AccountBlock) ([]*core.AccountBlock, error) {
func (virtualVerifier) VerifyABsProducer(abs map[types.Gid][]*core.AccountBlock) ([]*core.AccountBlock, error) {
var result []*core.AccountBlock
for _, v := range abs {
result = append(result, v...)
}
return result, nil
}

func (noneVerifier) VerifySnapshotProducer(block *core.SnapshotBlock) (bool, error) {
func (virtualVerifier) VerifySnapshotProducer(block *core.SnapshotBlock) (bool, error) {
return true, nil
}
8 changes: 4 additions & 4 deletions node/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ func (c *Config) MakeSubscribeConfig() *config.Subscribe {
}
func (c *Config) MakeMinerConfig() *config.Producer {
cfg := &config.Producer{
Producer: c.MinerEnabled,
Coinbase: c.CoinBase,
EntropyStorePath: c.EntropyStorePath,
NoneSnapshotVerifier: false,
Producer: c.MinerEnabled,
Coinbase: c.CoinBase,
EntropyStorePath: c.EntropyStorePath,
VirtualSnapshotVerifier: false,
}
err := cfg.Parse()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions vite.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func (v *Vite) Init() (err error) {

// initOnRoadPool
v.onRoad.Init(v.chain)
if v.config.Producer.NoneSnapshotVerifier {
v.verifier.Init(consensus.NewNoneVerifier(), v.Consensus().SBPReader(), v.onRoad)
if v.config.Producer.VirtualSnapshotVerifier {
v.verifier.Init(consensus.NewVirtualVerifier(), v.Consensus().SBPReader(), v.onRoad)
} else {
v.verifier.Init(v.consensus, v.Consensus().SBPReader(), v.onRoad)
}
Expand Down

0 comments on commit 5dfa38b

Please sign in to comment.