@@ -213,9 +213,6 @@ type Ethereum struct {
213213 chainDb ethdb.Database // Block chain database
214214 dappDb ethdb.Database // Dapp database
215215
216- // Closed when databases are flushed and closed
217- databasesClosed chan bool
218-
219216 //*** SERVICES ***
220217 // State manager for processing new blocks and managing the over all states
221218 blockProcessor * core.BlockProcessor
@@ -337,7 +334,6 @@ func New(config *Config) (*Ethereum, error) {
337334
338335 eth := & Ethereum {
339336 shutdownChan : make (chan bool ),
340- databasesClosed : make (chan bool ),
341337 chainDb : chainDb ,
342338 dappDb : dappDb ,
343339 eventMux : & event.TypeMux {},
@@ -549,8 +545,6 @@ func (s *Ethereum) Start() error {
549545 if err != nil {
550546 return err
551547 }
552- // periodically flush databases
553- go s .syncDatabases ()
554548
555549 if s .AutoDAG {
556550 s .StartAutoDAG ()
@@ -566,32 +560,6 @@ func (s *Ethereum) Start() error {
566560 return nil
567561}
568562
569- // sync databases every minute. If flushing fails we exit immediatly. The system
570- // may not continue under any circumstances.
571- func (s * Ethereum ) syncDatabases () {
572- ticker := time .NewTicker (1 * time .Minute )
573- done:
574- for {
575- select {
576- case <- ticker .C :
577- // don't change the order of database flushes
578- if err := s .dappDb .Flush (); err != nil {
579- glog .Fatalf ("fatal error: flush dappDb: %v (Restart your node. We are aware of this issue)\n " , err )
580- }
581- if err := s .chainDb .Flush (); err != nil {
582- glog .Fatalf ("fatal error: flush chainDb: %v (Restart your node. We are aware of this issue)\n " , err )
583- }
584- case <- s .shutdownChan :
585- break done
586- }
587- }
588-
589- s .chainDb .Close ()
590- s .dappDb .Close ()
591-
592- close (s .databasesClosed )
593- }
594-
595563func (s * Ethereum ) StartForTest () {
596564 jsonlogger .LogJson (& logger.LogStarting {
597565 ClientString : s .net .Name ,
@@ -622,12 +590,13 @@ func (s *Ethereum) Stop() {
622590 }
623591 s .StopAutoDAG ()
624592
593+ s .chainDb .Close ()
594+ s .dappDb .Close ()
625595 close (s .shutdownChan )
626596}
627597
628598// This function will wait for a shutdown and resumes main thread execution
629599func (s * Ethereum ) WaitForShutdown () {
630- <- s .databasesClosed
631600 <- s .shutdownChan
632601}
633602
0 commit comments