Skip to content

Commit 1c43ebf

Browse files
Fix duplicate contracts check (#111)
1 parent a482186 commit 1c43ebf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/dipdup/dipdup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ async def reload_config(self) -> None:
9191
raise RuntimeError('Config is not initialized')
9292
await self.add_index(index_config)
9393

94+
self._ctx.reset()
95+
9496
contracts = [index._config.contracts for index in self._indexes.values() if index._config.contracts]
97+
if not contracts:
98+
return
99+
95100
plain_contracts = reduce(operator.add, contracts)
96101
duplicate_contracts = [cast(ContractConfig, item).name for item, count in Counter(plain_contracts).items() if count > 1]
97102
if duplicate_contracts:
@@ -100,8 +105,6 @@ async def reload_config(self) -> None:
100105
' '.join(duplicate_contracts),
101106
)
102107

103-
self._ctx.reset()
104-
105108
async def dispatch_operations(self, datasource: TzktDatasource, operations: List[OperationData], block: HeadBlockData) -> None:
106109
assert len(set(op.level for op in operations)) == 1
107110
level = operations[0].level

0 commit comments

Comments
 (0)