Skip to content

Commit 0933b2a

Browse files
committed
Always re-index latest Cadence block
1 parent 25b8222 commit 0933b2a

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

bootstrap/bootstrap.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,15 @@ func (b *Bootstrap) StartEventIngestion(ctx context.Context) error {
143143

144144
chainID := b.config.FlowNetworkID
145145

146-
// the event subscriber takes the first block to sync from the Access node, which is the block
147-
// after the latest cadence block
148-
nextCadenceHeight := latestCadenceHeight + 1
149-
// Special case when using a local Emulator as Access Node. The Emulator
150-
// always starts at block height 0, so if we try to subscribe at block
151-
// height 1, we'll get an error, as it doesn't exist.
152-
if latestCadenceHeight == config.EmulatorInitCadenceHeight {
153-
nextCadenceHeight -= 1
154-
}
155-
156-
// create event subscriber
146+
// Create EVM event subscriber
147+
// Event ingestion & tx replay is idempotent, so we use the
148+
// `latestCadenceHeight` to be on the safe side.
157149
subscriber := ingestion.NewRPCEventSubscriber(
158150
b.logger,
159151
b.client,
160152
chainID,
161153
b.keystore,
162-
nextCadenceHeight,
154+
latestCadenceHeight,
163155
)
164156

165157
callTracerCollector, err := replayer.NewCallTracerCollector(

0 commit comments

Comments
 (0)