Skip to content

Commit 84d11c1

Browse files
committed
eth: remove dapp database remains
1 parent 312263c commit 84d11c1

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

core/types.go

-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,5 @@ type Backend interface {
7373
BlockChain() *BlockChain
7474
TxPool() *TxPool
7575
ChainDb() ethdb.Database
76-
DappDb() ethdb.Database
7776
EventMux() *event.TypeMux
7877
}

eth/backend.go

+6-22
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ type Ethereum struct {
115115
protocolManager *ProtocolManager
116116
// DB interfaces
117117
chainDb ethdb.Database // Block chain database
118-
dappDb ethdb.Database // Dapp database
119118

120119
eventMux *event.TypeMux
121120
pow *ethash.Ethash
@@ -142,7 +141,7 @@ type Ethereum struct {
142141
// New creates a new Ethereum object (including the
143142
// initialisation of the common Ethereum object)
144143
func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
145-
chainDb, dappDb, err := CreateDBs(ctx, config)
144+
chainDb, err := createDB(ctx, config)
146145
if err != nil {
147146
return nil, err
148147
}
@@ -157,7 +156,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
157156

158157
eth := &Ethereum{
159158
chainDb: chainDb,
160-
dappDb: dappDb,
161159
eventMux: ctx.EventMux,
162160
accountManager: ctx.AccountManager,
163161
pow: pow,
@@ -243,25 +241,13 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
243241
return eth, nil
244242
}
245243

246-
// CreateDBs creates the chain and dapp databases for an Ethereum service
247-
func CreateDBs(ctx *node.ServiceContext, config *Config) (chainDb, dappDb ethdb.Database, err error) {
248-
// Open the chain database and perform any upgrades needed
249-
chainDb, err = ctx.OpenDatabase("chaindata", config.DatabaseCache, config.DatabaseHandles)
250-
if err != nil {
251-
return nil, nil, err
252-
}
253-
if db, ok := chainDb.(*ethdb.LDBDatabase); ok {
244+
// createDB creates the chain database.
245+
func createDB(ctx *node.ServiceContext, config *Config) (ethdb.Database, error) {
246+
db, err := ctx.OpenDatabase("chaindata", config.DatabaseCache, config.DatabaseHandles)
247+
if db, ok := db.(*ethdb.LDBDatabase); ok {
254248
db.Meter("eth/db/chaindata/")
255249
}
256-
257-
dappDb, err = ctx.OpenDatabase("dapp", config.DatabaseCache, config.DatabaseHandles)
258-
if err != nil {
259-
return nil, nil, err
260-
}
261-
if db, ok := dappDb.(*ethdb.LDBDatabase); ok {
262-
db.Meter("eth/db/dapp/")
263-
}
264-
return
250+
return db, err
265251
}
266252

267253
// SetupGenesisBlock initializes the genesis block for an Ethereum service
@@ -389,7 +375,6 @@ func (s *Ethereum) TxPool() *core.TxPool { return s.txPool }
389375
func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux }
390376
func (s *Ethereum) Pow() *ethash.Ethash { return s.pow }
391377
func (s *Ethereum) ChainDb() ethdb.Database { return s.chainDb }
392-
func (s *Ethereum) DappDb() ethdb.Database { return s.dappDb }
393378
func (s *Ethereum) IsListening() bool { return true } // Always listening
394379
func (s *Ethereum) EthVersion() int { return int(s.protocolManager.SubProtocols[0].Version) }
395380
func (s *Ethereum) NetVersion() int { return s.netVersionId }
@@ -427,7 +412,6 @@ func (s *Ethereum) Stop() error {
427412
s.StopAutoDAG()
428413

429414
s.chainDb.Close()
430-
s.dappDb.Close()
431415
close(s.shutdownChan)
432416

433417
return nil

ethdb/database.go

-2
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ var OpenFileLimit = 64
3939
// cacheRatio specifies how the total allotted cache is distributed between the
4040
// various system databases.
4141
var cacheRatio = map[string]float64{
42-
"dapp": 0.0,
4342
"chaindata": 1.0,
4443
}
4544

4645
// handleRatio specifies how the total allotted file descriptors is distributed
4746
// between the various system databases.
4847
var handleRatio = map[string]float64{
49-
"dapp": 0.0,
5048
"chaindata": 1.0,
5149
}
5250

0 commit comments

Comments
 (0)