From 2e496f3af2ad12a3a0720f8b3b5b8f698aced73b Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 11 Sep 2023 17:50:49 +0800 Subject: [PATCH] fix service init --- main/main.go | 15 ++++++--------- service.go | 1 - 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/main/main.go b/main/main.go index 9bde8fc..0ab262f 100644 --- a/main/main.go +++ b/main/main.go @@ -16,19 +16,14 @@ import ( ) var ( - pluginLoader core.PluginLoader - gethContext core.Context - service *statediff.Service - blockchain statediff.BlockChain + gethContext core.Context + service *statediff.Service + blockchain statediff.BlockChain ) func Initialize(ctx core.Context, pl core.PluginLoader, logger core.Logger) { log.SetDefaultLogger(logger) - - pluginLoader = pl gethContext = ctx - - log.Debug("Initialized statediff plugin") } func InitializeNode(stack core.Node, b core.Backend) { @@ -58,7 +53,7 @@ func InitializeNode(stack core.Node, b core.Backend) { log.Error("failed to construct indexer", "error", err) } } - service, err := statediff.NewService(serviceConfig, blockchain, backend, indexer) + service, err = statediff.NewService(serviceConfig, blockchain, backend, indexer) if err != nil { log.Error("failed to construct service", "error", err) } @@ -66,6 +61,8 @@ func InitializeNode(stack core.Node, b core.Backend) { log.Error("failed to start service", "error", err) return } + + log.Debug("Initialized statediff plugin") } func GetAPIs(stack core.Node, backend core.Backend) []core.API { diff --git a/service.go b/service.go index 099e0a9..fe1ac69 100644 --- a/service.go +++ b/service.go @@ -885,7 +885,6 @@ func (sds *Service) UnsubscribeWriteStatus(id SubID) { // add | remove | set | clear func (sds *Service) WatchAddress(operation types2.OperationType, args []types2.WatchAddressArg) error { sds.writeLoopParams.Lock() - log.Debug("WatchAddress: locked sds.writeLoopParams") defer sds.writeLoopParams.Unlock() // get the current block number