mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
all: remove empty function SaveData()
This commit is contained in:
parent
efa2605f26
commit
240757a1ce
15 changed files with 4 additions and 47 deletions
|
|
@ -71,8 +71,6 @@ func (XDCx *XDCX) Start(server *p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (XDCx *XDCX) SaveData() {
|
|
||||||
}
|
|
||||||
func (XDCx *XDCX) Stop() error {
|
func (XDCx *XDCX) Stop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,6 @@ func (l *Lending) Start(server *p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *Lending) SaveData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *Lending) Stop() error {
|
func (l *Lending) Stop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -922,12 +922,7 @@ func (bc *BlockChain) TrieNode(hash common.Hash) ([]byte, error) {
|
||||||
return bc.stateCache.TrieDB().Node(hash)
|
return bc.stateCache.TrieDB().Node(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *BlockChain) SaveData() {
|
func (bc *BlockChain) saveData() {
|
||||||
bc.wg.Add(1)
|
|
||||||
defer bc.wg.Done()
|
|
||||||
// Make sure no inconsistent state is leaked during insertion
|
|
||||||
bc.mu.Lock()
|
|
||||||
defer bc.mu.Unlock()
|
|
||||||
// Ensure the state of a recent block is also stored to disk before exiting.
|
// Ensure the state of a recent block is also stored to disk before exiting.
|
||||||
// We're writing three different states to catch different restart scenarios:
|
// We're writing three different states to catch different restart scenarios:
|
||||||
// - HEAD: So we don't need to reprocess any blocks in the general case
|
// - HEAD: So we don't need to reprocess any blocks in the general case
|
||||||
|
|
@ -1011,7 +1006,7 @@ func (bc *BlockChain) Stop() {
|
||||||
close(bc.quit)
|
close(bc.quit)
|
||||||
atomic.StoreInt32(&bc.procInterrupt, 1)
|
atomic.StoreInt32(&bc.procInterrupt, 1)
|
||||||
bc.wg.Wait()
|
bc.wg.Wait()
|
||||||
bc.SaveData()
|
bc.saveData()
|
||||||
log.Info("Blockchain manager stopped")
|
log.Info("Blockchain manager stopped")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -557,10 +557,6 @@ func (e *Ethereum) Start(srvr *p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Ethereum) SaveData() {
|
|
||||||
e.blockchain.SaveData()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop implements node.Service, terminating all internal goroutines used by the
|
// Stop implements node.Service, terminating all internal goroutines used by the
|
||||||
// Ethereum protocol.
|
// Ethereum protocol.
|
||||||
func (e *Ethereum) Stop() error {
|
func (e *Ethereum) Stop() error {
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,6 @@ func (s *Service) Start(server *p2p.Server) error {
|
||||||
log.Info("Stats daemon started")
|
log.Info("Stats daemon started")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (s *Service) SaveData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop implements node.Service, terminating the monitoring and reporting daemon.
|
// Stop implements node.Service, terminating the monitoring and reporting daemon.
|
||||||
func (s *Service) Stop() error {
|
func (s *Service) Stop() error {
|
||||||
|
|
|
||||||
|
|
@ -228,10 +228,6 @@ func (s *LightEthereum) Start(srvr *p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LightEthereum) SaveData() {
|
|
||||||
s.blockchain.SaveData()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop implements node.Service, terminating all internal goroutines used by the
|
// Stop implements node.Service, terminating all internal goroutines used by the
|
||||||
// Ethereum protocol.
|
// Ethereum protocol.
|
||||||
func (s *LightEthereum) Stop() error {
|
func (s *LightEthereum) Stop() error {
|
||||||
|
|
|
||||||
|
|
@ -281,9 +281,6 @@ func (lc *LightChain) GetBlockByNumber(ctx context.Context, number uint64) (*typ
|
||||||
return lc.GetBlock(ctx, hash, number)
|
return lc.GetBlock(ctx, hash, number)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *LightChain) SaveData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop stops the blockchain service. If any imports are currently in progress
|
// Stop stops the blockchain service. If any imports are currently in progress
|
||||||
// it will abort them using the procInterrupt.
|
// it will abort them using the procInterrupt.
|
||||||
func (lc *LightChain) Stop() {
|
func (lc *LightChain) Stop() {
|
||||||
|
|
|
||||||
|
|
@ -478,9 +478,6 @@ func (n *Node) Stop() error {
|
||||||
return ErrNodeStopped
|
return ErrNodeStopped
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, service := range n.services {
|
|
||||||
service.SaveData()
|
|
||||||
}
|
|
||||||
// Terminate the API, services and the p2p server.
|
// Terminate the API, services and the p2p server.
|
||||||
n.stopWS()
|
n.stopWS()
|
||||||
n.stopHTTP()
|
n.stopHTTP()
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ type SampleService struct{}
|
||||||
func (s *SampleService) Protocols() []p2p.Protocol { return nil }
|
func (s *SampleService) Protocols() []p2p.Protocol { return nil }
|
||||||
func (s *SampleService) APIs() []rpc.API { return nil }
|
func (s *SampleService) APIs() []rpc.API { return nil }
|
||||||
func (s *SampleService) Start(*p2p.Server) error { fmt.Println("Service starting..."); return nil }
|
func (s *SampleService) Start(*p2p.Server) error { fmt.Println("Service starting..."); return nil }
|
||||||
func (s *SampleService) SaveData() {}
|
|
||||||
func (s *SampleService) Stop() error { fmt.Println("Service stopping..."); return nil }
|
func (s *SampleService) Stop() error { fmt.Println("Service stopping..."); return nil }
|
||||||
|
|
||||||
func ExampleService() {
|
func ExampleService() {
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,7 @@ type Service interface {
|
||||||
// Start is called after all services have been constructed and the networking
|
// Start is called after all services have been constructed and the networking
|
||||||
// layer was also initialized to spawn any goroutines required by the service.
|
// layer was also initialized to spawn any goroutines required by the service.
|
||||||
Start(server *p2p.Server) error
|
Start(server *p2p.Server) error
|
||||||
//Save data before stop
|
|
||||||
SaveData()
|
|
||||||
// Stop terminates all goroutines belonging to the service, blocking until they
|
// Stop terminates all goroutines belonging to the service, blocking until they
|
||||||
// are all terminated.
|
// are all terminated.
|
||||||
Stop() error
|
Stop() error
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ type NoopService struct{}
|
||||||
func (s *NoopService) Protocols() []p2p.Protocol { return nil }
|
func (s *NoopService) Protocols() []p2p.Protocol { return nil }
|
||||||
func (s *NoopService) APIs() []rpc.API { return nil }
|
func (s *NoopService) APIs() []rpc.API { return nil }
|
||||||
func (s *NoopService) Start(*p2p.Server) error { return nil }
|
func (s *NoopService) Start(*p2p.Server) error { return nil }
|
||||||
func (s *NoopService) SaveData() {}
|
|
||||||
func (s *NoopService) Stop() error { return nil }
|
func (s *NoopService) Stop() error { return nil }
|
||||||
|
|
||||||
func NewNoopService(*ServiceContext) (Service, error) { return new(NoopService), nil }
|
func NewNoopService(*ServiceContext) (Service, error) { return new(NoopService), nil }
|
||||||
|
|
@ -79,8 +78,7 @@ func (s *InstrumentedService) Start(server *p2p.Server) error {
|
||||||
}
|
}
|
||||||
return s.start
|
return s.start
|
||||||
}
|
}
|
||||||
func (s *InstrumentedService) SaveData() {
|
|
||||||
}
|
|
||||||
func (s *InstrumentedService) Stop() error {
|
func (s *InstrumentedService) Stop() error {
|
||||||
if s.stopHook != nil {
|
if s.stopHook != nil {
|
||||||
s.stopHook()
|
s.stopHook()
|
||||||
|
|
|
||||||
|
|
@ -504,8 +504,6 @@ func (s *snapshotService) Start(*p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *snapshotService) SaveData() {
|
|
||||||
}
|
|
||||||
func (s *snapshotService) Stop() error {
|
func (s *snapshotService) Stop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,6 @@ func (p *pingPongService) Start(server *p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pingPongService) SaveData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *pingPongService) Stop() error {
|
func (p *pingPongService) Stop() error {
|
||||||
p.log.Info("ping-pong service stopping")
|
p.log.Info("ping-pong service stopping")
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,6 @@ func (t *testService) Start(server *p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *testService) SaveData() {
|
|
||||||
}
|
|
||||||
func (t *testService) Stop() error {
|
func (t *testService) Stop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,6 @@ func (tn *testNode) Start(server *p2p.Server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tn *testNode) SaveData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tn *testNode) Stop() error {
|
func (tn *testNode) Stop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -201,9 +198,6 @@ func (mn *mockNode) Expect(exp ...Expect) error {
|
||||||
return <-mn.err
|
return <-mn.err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mn *mockNode) SaveData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mn *mockNode) Stop() error {
|
func (mn *mockNode) Stop() error {
|
||||||
mn.stopOnce.Do(func() { close(mn.stop) })
|
mn.stopOnce.Do(func() { close(mn.stop) })
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue