-
Notifications
You must be signed in to change notification settings - Fork 1
/
initmain.go
38 lines (30 loc) · 1.08 KB
/
initmain.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
35
36
37
38
package main
import (
"github.com/copernet/copernicus/conf"
"github.com/copernet/copernicus/crypto"
"github.com/copernet/copernicus/log"
"github.com/copernet/copernicus/logic/blockindex"
lchain "github.com/copernet/copernicus/logic/chain"
"github.com/copernet/copernicus/model/chain"
"github.com/copernet/copernicus/model/mempool"
"github.com/copernet/copernicus/model/utxo"
"github.com/copernet/copernicus/persist/blkdb"
"github.com/copernet/copernicus/persist/db"
"github.com/copernet/copernicus/persist/global"
)
func appInitMain() {
log.Init()
// Init UTXO DB
utxoConfig := utxo.UtxoConfig{Do: &db.DBOption{FilePath: conf.Cfg.DataDir + "/chainstate", CacheSize: (1 << 20) * 8}}
utxo.InitUtxoLruTip(&utxoConfig)
chain.InitGlobalChain()
// Init blocktree DB
blkdbCfg := blkdb.BlockTreeDBConfig{Do: &db.DBOption{FilePath: conf.Cfg.DataDir + "/blocks/index", CacheSize: (1 << 20) * 8}}
blkdb.InitBlockTreeDB(&blkdbCfg)
global.InitPersistGlobal()
// Load blockindex DB
blockindex.LoadBlockIndexDB()
lchain.InitGenesisChain()
mempool.InitMempool()
crypto.InitSecp256()
}