fix service init
This commit is contained in:
parent
e43cbb30f9
commit
2e496f3af2
@ -16,7 +16,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pluginLoader core.PluginLoader
|
|
||||||
gethContext core.Context
|
gethContext core.Context
|
||||||
service *statediff.Service
|
service *statediff.Service
|
||||||
blockchain statediff.BlockChain
|
blockchain statediff.BlockChain
|
||||||
@ -24,11 +23,7 @@ var (
|
|||||||
|
|
||||||
func Initialize(ctx core.Context, pl core.PluginLoader, logger core.Logger) {
|
func Initialize(ctx core.Context, pl core.PluginLoader, logger core.Logger) {
|
||||||
log.SetDefaultLogger(logger)
|
log.SetDefaultLogger(logger)
|
||||||
|
|
||||||
pluginLoader = pl
|
|
||||||
gethContext = ctx
|
gethContext = ctx
|
||||||
|
|
||||||
log.Debug("Initialized statediff plugin")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitializeNode(stack core.Node, b core.Backend) {
|
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)
|
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 {
|
if err != nil {
|
||||||
log.Error("failed to construct service", "error", err)
|
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)
|
log.Error("failed to start service", "error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debug("Initialized statediff plugin")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAPIs(stack core.Node, backend core.Backend) []core.API {
|
func GetAPIs(stack core.Node, backend core.Backend) []core.API {
|
||||||
|
@ -885,7 +885,6 @@ func (sds *Service) UnsubscribeWriteStatus(id SubID) {
|
|||||||
// add | remove | set | clear
|
// add | remove | set | clear
|
||||||
func (sds *Service) WatchAddress(operation types2.OperationType, args []types2.WatchAddressArg) error {
|
func (sds *Service) WatchAddress(operation types2.OperationType, args []types2.WatchAddressArg) error {
|
||||||
sds.writeLoopParams.Lock()
|
sds.writeLoopParams.Lock()
|
||||||
log.Debug("WatchAddress: locked sds.writeLoopParams")
|
|
||||||
defer sds.writeLoopParams.Unlock()
|
defer sds.writeLoopParams.Unlock()
|
||||||
|
|
||||||
// get the current block number
|
// get the current block number
|
||||||
|
Loading…
Reference in New Issue
Block a user