@@ -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)
144143func 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 }
389375func (s * Ethereum ) EventMux () * event.TypeMux { return s .eventMux }
390376func (s * Ethereum ) Pow () * ethash.Ethash { return s .pow }
391377func (s * Ethereum ) ChainDb () ethdb.Database { return s .chainDb }
392- func (s * Ethereum ) DappDb () ethdb.Database { return s .dappDb }
393378func (s * Ethereum ) IsListening () bool { return true } // Always listening
394379func (s * Ethereum ) EthVersion () int { return int (s .protocolManager .SubProtocols [0 ].Version ) }
395380func (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
0 commit comments