Skip to content

Commit

Permalink
core: fix diff store handles
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi committed Mar 12, 2024
1 parent 20d9ff3 commit afc3eac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,18 +787,19 @@ func (n *Node) OpenDatabase(name string, cache, handles int, namespace string, r
}

func (n *Node) OpenAndMergeDatabase(name string, namespace string, readonly bool, config *ethconfig.Config) (ethdb.Database, error) {
chainDataHandles := config.DatabaseHandles
chainDbCache := config.DatabaseCache
var (
err error
stateDiskDb ethdb.Database
blockDb ethdb.Database
disableChainDbFreeze = false
blockDbHandlesSize int
diffStoreHandles int
chainDataHandles = config.DatabaseHandles
chainDbCache = config.DatabaseCache
)

if config.PersistDiff {
chainDataHandles = config.DatabaseHandles * diffStoreHandlesPercentage / 100
diffStoreHandles = config.DatabaseHandles * diffStoreHandlesPercentage / 100
}
isMultiDatabase := n.CheckIfMultiDataBase()
// Open the separated state database if the state directory exists
Expand Down Expand Up @@ -841,7 +842,7 @@ func (n *Node) OpenAndMergeDatabase(name string, namespace string, readonly bool
}

if config.PersistDiff {
diffStore, err := n.OpenDiffDatabase(name, config.DatabaseHandles-chainDataHandles, config.DatabaseDiff, namespace, readonly)
diffStore, err := n.OpenDiffDatabase(name, diffStoreHandles, config.DatabaseDiff, namespace, readonly)
if err != nil {
chainDB.Close()
return nil, err
Expand Down

0 comments on commit afc3eac

Please sign in to comment.