mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
parent
80b5954c3c
commit
36fc6a3950
@ -1168,7 +1168,6 @@ func getBlockReader(db kv.RoDB) (blockReader services.FullBlockReader) {
|
||||
}
|
||||
|
||||
func newSync(ctx context.Context, db kv.RwDB, miningConfig *params.MiningConfig) (consensus.Engine, *vm.Config, *stagedsync.Sync, *stagedsync.Sync, stagedsync.MiningState) {
|
||||
logger := log.New()
|
||||
dirs, historyV3, pm := datadir.New(datadirCli), kvcfg.HistoryV3.FromDB(db), fromdb.PruneMode(db)
|
||||
|
||||
vmConfig := &vm.Config{}
|
||||
@ -1202,7 +1201,7 @@ func newSync(ctx context.Context, db kv.RwDB, miningConfig *params.MiningConfig)
|
||||
allSn, agg := allSnapshots(db)
|
||||
cfg.Snapshot = allSn.Cfg()
|
||||
|
||||
engine := initConsensusEngine(chainConfig, logger, allSn, cfg.Dirs.DataDir, db)
|
||||
engine := initConsensusEngine(chainConfig, cfg.Dirs.DataDir, db)
|
||||
|
||||
br := getBlockReader(db)
|
||||
sentryControlServer, err := sentry.NewMultiClient(
|
||||
@ -1283,25 +1282,27 @@ func overrideStorageMode(db kv.RwDB) error {
|
||||
})
|
||||
}
|
||||
|
||||
func initConsensusEngine(chainConfig *params.ChainConfig, logger log.Logger, snapshots *snapshotsync.RoSnapshots, datadir string, db kv.RwDB) (engine consensus.Engine) {
|
||||
func initConsensusEngine(chainConfig *params.ChainConfig, datadir string, db kv.RwDB) (engine consensus.Engine) {
|
||||
logger := log.New()
|
||||
snapshots, _ := allSnapshots(db)
|
||||
config := ethconfig.Defaults
|
||||
|
||||
switch {
|
||||
case chainConfig.Clique != nil:
|
||||
c := params.CliqueSnapshot
|
||||
c.DBPath = filepath.Join(datadir, "clique", "db")
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, c, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, true /* readonly */, db)
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, c, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, db.ReadOnly(), db)
|
||||
case chainConfig.Aura != nil:
|
||||
consensusConfig := ¶ms.AuRaConfig{DBPath: filepath.Join(datadir, "aura")}
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, true /* readonly */, db)
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, db.ReadOnly(), db)
|
||||
case chainConfig.Parlia != nil:
|
||||
// Apply special hacks for BSC params
|
||||
params.ApplyBinanceSmartChainParams()
|
||||
consensusConfig := ¶ms.ParliaConfig{DBPath: filepath.Join(datadir, "parlia")}
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, true /* readonly */, db)
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, db.ReadOnly(), db)
|
||||
case chainConfig.Bor != nil:
|
||||
consensusConfig := &config.Bor
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, HeimdallURL, false, datadir, snapshots, true /* readonly */, db)
|
||||
engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, HeimdallURL, false, datadir, snapshots, db.ReadOnly(), db)
|
||||
default: //ethash
|
||||
engine = ethash.NewFaker()
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ func (mi *MutationItem) Less(than btree.Item) bool {
|
||||
return bytes.Compare(mi.key, i.key) < 0
|
||||
}
|
||||
|
||||
func (m *mutation) ReadOnly() bool { return false }
|
||||
func (m *mutation) RwKV() kv.RwDB {
|
||||
if casted, ok := m.db.(ethdb.HasRwKV); ok {
|
||||
return casted.RwKV()
|
||||
|
4
go.mod
4
go.mod
@ -3,7 +3,7 @@ module github.com/ledgerwatch/erigon
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221227055016-a8f528486df4
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221228054641-3139d0b2d744
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221223003841-487873d31492
|
||||
github.com/ledgerwatch/log/v3 v3.6.0
|
||||
github.com/ledgerwatch/secp256k1 v1.0.0
|
||||
@ -49,6 +49,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/julienschmidt/httprouter v1.3.0
|
||||
github.com/kevinburke/go-bindata v3.21.0+incompatible
|
||||
github.com/klauspost/compress v1.15.10
|
||||
github.com/libp2p/go-libp2p v0.23.2
|
||||
github.com/libp2p/go-libp2p-core v0.20.1
|
||||
github.com/libp2p/go-libp2p-pubsub v0.8.1
|
||||
@ -151,7 +152,6 @@ require (
|
||||
github.com/ipfs/go-log/v2 v2.5.1 // indirect
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/klauspost/compress v1.15.10 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
|
||||
github.com/koron/go-ssdp v0.0.3 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
|
4
go.sum
4
go.sum
@ -563,8 +563,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3PYPwICLl+/9oulQauOuETfgFvhBDffs0=
|
||||
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
|
||||
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221227055016-a8f528486df4 h1:KYSdNN4l0LVx+l7ch9R9tHOSsCkxBR+ogk8xxc3tjg0=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221227055016-a8f528486df4/go.mod h1:tH/g/HJjsZzplt6I6HtJPiYUD51cWGl1FXY6FcJsE8I=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221228054641-3139d0b2d744 h1:JJYFaMT4/5iHSNo9dCrMkxoVlysdeJ6+k5YIk2oJ6uQ=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221228054641-3139d0b2d744/go.mod h1:tH/g/HJjsZzplt6I6HtJPiYUD51cWGl1FXY6FcJsE8I=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221223003841-487873d31492 h1:SSYvbAzdreVrXdy8z8A92ug36c7zsGQLzXFrSiw92Zc=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221223003841-487873d31492/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo=
|
||||
github.com/ledgerwatch/log/v3 v3.6.0 h1:JBUSK1epPyutUrz7KYDTcJtQLEHnehECRpKbM1ugy5M=
|
||||
|
Loading…
Reference in New Issue
Block a user