mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
integration temporal db
This commit is contained in:
parent
cff73b8aec
commit
3913a99341
2
.github/ISSUE_TEMPLATE/question.md
vendored
2
.github/ISSUE_TEMPLATE/question.md
vendored
@ -6,4 +6,4 @@ labels: 'type:docs'
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
This should only be used in very rare cases e.g. if you are not 100% sure if something is a bug or asking a question that leads to improving the documentation. For general questions please use [Erigon's discord](https://discord.gg/hQ2dxbNZ).
|
||||
This should only be used in very rare cases e.g. if you are not 100% sure if something is a bug or asking a question that leads to improving the documentation. For general questions please use [Erigon's discord](https://github.com/ledgerwatch/erigon#erigon-discord-server).
|
||||
|
@ -1,11 +1,17 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/c2h5oh/datasize"
|
||||
"github.com/ledgerwatch/erigon-lib/kv"
|
||||
"github.com/ledgerwatch/erigon-lib/kv/kvcfg"
|
||||
kv2 "github.com/ledgerwatch/erigon-lib/kv/mdbx"
|
||||
"github.com/ledgerwatch/erigon/core/state/historyv2read"
|
||||
"github.com/ledgerwatch/erigon/core/state/temporal"
|
||||
"github.com/ledgerwatch/erigon/core/systemcontracts"
|
||||
"github.com/ledgerwatch/erigon/core/types/accounts"
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/torquem-ch/mdbx-go/mdbx"
|
||||
@ -74,5 +80,28 @@ func openDB(opts kv2.MdbxOpts, applyMigrations bool) kv.RwDB {
|
||||
db = opts.MustOpen()
|
||||
}
|
||||
}
|
||||
|
||||
if opts.GetLabel() == kv.ChainDB {
|
||||
var h3 bool
|
||||
var err error
|
||||
if err := db.View(context.Background(), func(tx kv.Tx) error {
|
||||
h3, err = kvcfg.HistoryV3.Enabled(tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if h3 {
|
||||
_, agg := allSnapshots(context.Background(), db)
|
||||
tdb, err := temporal.New(db, agg, accounts.ConvertV3toV2, historyv2read.RestoreCodeHash, accounts.DecodeIncarnationFromStorage, systemcontracts.SystemContractCodeLookup[chain])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
db = tdb
|
||||
}
|
||||
}
|
||||
|
||||
return db
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user