Skip to content

Commit

Permalink
Start event ingestion on proper block height when connecting to local…
Browse files Browse the repository at this point in the history
… Emulator
  • Loading branch information
m-Peter committed Feb 10, 2025
1 parent 4d3dfcd commit 36fe0b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ func (b *Bootstrap) StartEventIngestion(ctx context.Context) error {
// the event subscriber takes the first block to sync from the Access node, which is the block
// after the latest cadence block
nextCadenceHeight := latestCadenceHeight + 1
// Special case when using a local Emulator as Access Node. The Emulator
// always starts at block height 0, so if we try to subscribe at block
// height 1, we'll get an error, as it doesn't exist.
if latestCadenceHeight == config.EmulatorInitCadenceHeight {
nextCadenceHeight -= 1
}

// create event subscriber
subscriber := ingestion.NewRPCEventSubscriber(
Expand Down

0 comments on commit 36fe0b8

Please sign in to comment.