mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
ca3ad096e1
This fixes 2 related issues: * Now that the bor consensus engine is required for queries it can't be created based on the pretense of a db directory, but must be based on chain config read from the db. Using the DB presence causes Bor to get instantiated for non bor chains which breaks. * At the moment eth_calls on a remote daemon don't check Bor headers prior to calling the EVM code as it was just using a fake ETHash instance - which performs ETH header validation only. The current version is mostly working but needs adapting to perform lazy initialization of the engine.
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/common"
|
|
"github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli"
|
|
"github.com/ledgerwatch/erigon/rpc"
|
|
"github.com/ledgerwatch/erigon/turbo/debug"
|
|
"github.com/ledgerwatch/erigon/turbo/jsonrpc"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func main() {
|
|
cmd, cfg := cli.RootCommand()
|
|
rootCtx, rootCancel := common.RootContext()
|
|
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
|
ctx := cmd.Context()
|
|
logger := debug.SetupCobra(cmd, "sentry")
|
|
db, backend, txPool, mining, stateCache, blockReader, engine, ff, agg, err := cli.RemoteServices(ctx, *cfg, logger, rootCancel)
|
|
if err != nil {
|
|
logger.Error("Could not connect to DB", "err", err)
|
|
return nil
|
|
}
|
|
defer db.Close()
|
|
defer engine.Close()
|
|
|
|
apiList := jsonrpc.APIList(db, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg, engine, logger)
|
|
rpc.PreAllocateRPCMetricLabels(apiList)
|
|
if err := cli.StartRpcServer(ctx, *cfg, apiList, logger); err != nil {
|
|
logger.Error(err.Error())
|
|
return nil
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
if err := cmd.ExecuteContext(rootCtx); err != nil {
|
|
fmt.Printf("ExecuteContext: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|