Skip to content

Commit

Permalink
revert: shared genesis db (erigontech#6594)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
  • Loading branch information
AskAlexSharov and Alexey Sharp authored Jan 17, 2023
1 parent b248ffe commit 9e452fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
15 changes: 3 additions & 12 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"errors"
"fmt"
"math/big"
"os"
"sync"

"github.com/c2h5oh/datasize"
Expand Down Expand Up @@ -93,14 +92,6 @@ type AuthorityRoundSeal struct {
Signature libcommon.Hash `json:"signature"`
}

var genesisTmpDB kv.RwDB
var genesisDBLock *sync.Mutex

func init() {
genesisTmpDB = mdbx.NewMDBX(log.New()).InMem(os.TempDir()).MapSize(2 * datasize.GB).PageSize(2 * 4096).MustOpen()
genesisDBLock = &sync.Mutex{}
}

func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error {
m := make(map[common.UnprefixedAddress]GenesisAccount)
if err := json.Unmarshal(data, &m); err != nil {
Expand Down Expand Up @@ -381,9 +372,9 @@ func (g *Genesis) ToBlock() (*types.Block, *state.IntraBlockState, error) {
go func() { // we may run inside write tx, can't open 2nd write tx in same goroutine
// TODO(yperbasis): use memdb.MemoryMutation instead
defer wg.Done()
genesisDBLock.Lock()
defer genesisDBLock.Unlock()
tx, err := genesisTmpDB.BeginRw(context.Background())
tmpDB := mdbx.NewMDBX(log.New()).InMem("").MapSize(2 * datasize.GB).MustOpen()
defer tmpDB.Close()
tx, err := tmpDB.BeginRw(context.Background())
if err != nil {
panic(err)
}
Expand Down
8 changes: 4 additions & 4 deletions params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ var (

// see https://calver.org
const (
VersionMajor = 2 // Major version component of the current release
VersionMinor = 34 // Minor version component of the current release
VersionMicro = 0 // Patch version component of the current release
VersionModifier = "dev" // Modifier component of the current release
VersionMajor = 2 // Major version component of the current release
VersionMinor = 34 // Minor version component of the current release
VersionMicro = 0 // Patch version component of the current release
VersionModifier = "stable" // Modifier component of the current release
VersionKeyCreated = "ErigonVersionCreated"
VersionKeyFinished = "ErigonVersionFinished"
)
Expand Down

0 comments on commit 9e452fe

Please sign in to comment.