forked from vitelabs/go-vite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite_mock.go
34 lines (30 loc) · 859 Bytes
/
vite_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package vite
import (
"github.com/vitelabs/go-vite/v2/common/config"
nodeconfig "github.com/vitelabs/go-vite/v2/node/config"
"github.com/vitelabs/go-vite/v2/wallet"
)
func NewMock(cfg *config.Config, walletManager *wallet.Manager) (vite *Vite, err error) {
var nodeConfig *nodeconfig.Config
if cfg == nil || walletManager == nil {
nodeConfig = &nodeconfig.Config{}
//nodeConfig.ParseFromFile("~/go/src/github.com/vitelabs/go-vite/conf/evm/node_config.json")
}
if cfg == nil {
cfg = nodeConfig.MakeViteConfig()
}
if walletManager == nil {
walletManager = wallet.New(nodeConfig.MakeWalletConfig())
}
// TODO: use mocks for net, chain, pool, etc.
vite = &Vite{
config: cfg,
walletManager: walletManager,
net: nil,
chain: nil,
pool: nil,
consensus: nil,
verifier: nil,
}
return
}