Skip to content

Commit

Permalink
Fix indexing events multiple times (#194)
Browse files Browse the repository at this point in the history
* Fix indexing events multiple times

* Update changelog
  • Loading branch information
stwiname authored Oct 30, 2023
1 parent 98ab171 commit c4f6cb5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Missing dependencies for testing command (#194)
- Events getting processed multiple times (#194)

## [3.1.1] - 2023-10-26
### Fixed
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/indexer/indexer.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ export class IndexerManager extends BaseIndexerManager<
for (const msg of msgs) {
await this.indexMessage(msg, dataSources, getVM);
const events = blockContent.events.filter(
(event) => event.msg?.idx === msg.idx,
(event) => event.tx.hash === tx.hash && event.msg?.idx === msg.idx,
);

for (const evt of events) {
await this.indexEvent(evt, dataSources, getVM);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/node/src/subcommands/testing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
ConnectionPoolService,
ConnectionPoolStateManager,
DbModule,
InMemoryCacheService,
PoiService,
PoiSyncService,
StoreService,
TestRunner,
} from '@subql/node-core';
Expand All @@ -26,10 +28,12 @@ import { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';

@Module({
providers: [
InMemoryCacheService,
StoreService,
StoreCacheService,
EventEmitter2,
PoiService,
PoiSyncService,
SandboxService,
DsProcessorService,
DynamicDsService,
Expand Down
2 changes: 2 additions & 0 deletions packages/types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- JSDoc to field explaining definition (#194)

## [3.1.0] - 2023-10-20
### Changed
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export interface CosmosTransaction {
}

export interface CosmosMessage<T = any> {
/**
* The index of the message within the transaction
*/
idx: number;
block: CosmosBlock;
tx: CosmosTransaction;
Expand Down

0 comments on commit c4f6cb5

Please sign in to comment.