From bdf005903e73cda40e16161039d834669ae08934 Mon Sep 17 00:00:00 2001 From: billettc Date: Wed, 31 Jan 2024 08:13:17 -0500 Subject: [PATCH] change latestBlockRetryInterval value using a param --- Dockerfile | 3 +-- block/fetcher/rpc.go | 6 ++++++ cmd/firesol/rpc/fetcher.go | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7babc1c2..2b6329dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,5 +28,4 @@ ENV PATH "$PATH:/app" COPY --from=core /app/firecore /app/firecore -ENTRYPOINT ["/app/firesol"] - +ENTRYPOINT ["/app/firesol"] \ No newline at end of file diff --git a/block/fetcher/rpc.go b/block/fetcher/rpc.go index d5d0135f..a2db9569 100644 --- a/block/fetcher/rpc.go +++ b/block/fetcher/rpc.go @@ -217,6 +217,12 @@ func fixPreviousBlockHash(blockResult *rpc.GetBlockResult) (previousFixedBlockHa previousFixedBlockHash = "J6rRToKMK5DQDzVLqo7ibL3snwBYtqkYnRnQ7vXoUSEc" return previousFixedBlockHash } + case "2TLDT6Z3WJ5h5958BjdzMwmNGnVo3e4qcHyGBVgBPDm9": + //zlogger.Warn("applying horrible tweak to block 61,328,766") + if previousFixedBlockHash == "11111111111111111111111111111111" { + previousFixedBlockHash = "FCgBdK9Fufcsdc9RGu5SwMwbCFiw4SxNnJzCpZTdNpDq" + return previousFixedBlockHash + } } return blockResult.PreviousBlockhash.String() diff --git a/cmd/firesol/rpc/fetcher.go b/cmd/firesol/rpc/fetcher.go index c61fcab9..b7d0504a 100644 --- a/cmd/firesol/rpc/fetcher.go +++ b/cmd/firesol/rpc/fetcher.go @@ -28,6 +28,7 @@ func NewFetchCmd(logger *zap.Logger, tracer logging.Tracer) *cobra.Command { cmd.Flags().String("state-dir", "/data/poller", "interval between fetch") cmd.Flags().Duration("interval-between-fetch", 0, "interval between fetch") + cmd.Flags().Duration("latest-block-retry-interval", time.Second, "interval between fetch") cmd.Flags().Int("block-fetch-batch-size", 10, "Number of blocks to fetch in a single batch") return cmd @@ -53,11 +54,12 @@ func fetchRunE(logger *zap.Logger, tracer logging.Tracer) firecore.CommandExecut zap.String("state_dir", stateDir), zap.Uint64("first_streamable_block", startBlock), zap.Duration("interval_between_fetch", fetchInterval), + zap.Duration("latest_block_retry_interval", sflags.MustGetDuration(cmd, "latest-block-retry-interval")), ) rpcClient := rpc.New(rpcEndpoint) - latestBlockRetryInterval := 250 * time.Millisecond + latestBlockRetryInterval := sflags.MustGetDuration(cmd, "latest-block-retry-interval") poller := blockpoller.New( fetcher.NewRPC(rpcClient, fetchInterval, latestBlockRetryInterval, logger), blockpoller.NewFireBlockHandler("type.googleapis.com/sf.solana.type.v1.Block"),