From 5252965c9319f0da232a9bf06d44b8c5721ea8d9 Mon Sep 17 00:00:00 2001 From: Elvin Date: Mon, 21 Aug 2023 17:40:48 +0800 Subject: [PATCH] set gcConfidence = 2 * constants.ForkLengthThreshold --- app/submodule/eth/eth_api.go | 3 +-- app/submodule/eth/eth_event_api.go | 4 +--- pkg/events/events.go | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index 3e6e5cc7d3..27a5a9f89f 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -89,8 +89,7 @@ type ethAPI struct { } func (a *ethAPI) start(ctx context.Context) error { - const ChainHeadConfidence = 1 - ev, err := events.NewEventsWithConfidence(ctx, a.chain, ChainHeadConfidence) + ev, err := events.NewEvents(ctx, a.chain) if err != nil { return err } diff --git a/app/submodule/eth/eth_event_api.go b/app/submodule/eth/eth_event_api.go index 97ae8ba993..8f32cdac84 100644 --- a/app/submodule/eth/eth_event_api.go +++ b/app/submodule/eth/eth_event_api.go @@ -26,8 +26,6 @@ import ( "github.com/zyedidia/generic/queue" ) -const ChainHeadConfidence = 1 - var _ v1.IETHEvent = (*ethEventAPI)(nil) func newEthEventAPI(ctx context.Context, em *EthSubModule) (*ethEventAPI, error) { @@ -128,7 +126,7 @@ func (e *ethEventAPI) Start(ctx context.Context) error { // Start garbage collection for filters go e.GC(ctx, time.Duration(e.em.cfg.FevmConfig.Event.FilterTTL)) - ev, err := events.NewEventsWithConfidence(ctx, e.ChainAPI, ChainHeadConfidence) + ev, err := events.NewEvents(ctx, e.ChainAPI) if err != nil { return err } diff --git a/pkg/events/events.go b/pkg/events/events.go index b2c7523d98..0604abe5ab 100644 --- a/pkg/events/events.go +++ b/pkg/events/events.go @@ -24,7 +24,7 @@ type Events struct { *hcEvents } -func NewEventsWithConfidence(ctx context.Context, api IEvent, gcConfidence abi.ChainEpoch) (*Events, error) { +func newEventsWithConfidence(ctx context.Context, api IEvent, gcConfidence abi.ChainEpoch) (*Events, error) { cache := newCache(api, gcConfidence) ob := newObserver(cache, gcConfidence) @@ -40,5 +40,5 @@ func NewEventsWithConfidence(ctx context.Context, api IEvent, gcConfidence abi.C func NewEvents(ctx context.Context, api IEvent) (*Events, error) { gcConfidence := 2 * constants.ForkLengthThreshold - return NewEventsWithConfidence(ctx, api, gcConfidence) + return newEventsWithConfidence(ctx, api, gcConfidence) }