Skip to content

Commit

Permalink
refactor: required confs
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Nov 6, 2023
1 parent 91b894a commit e808769
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/ape/api/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1535,9 +1535,9 @@ def poll_logs(
required_confirmations: Optional[int] = None,
new_block_timeout: Optional[int] = None,
) -> Iterator[ContractLog]:
required_confirmations = (
required_confirmations or self.provider.network.required_confirmations
)
if required_confirmations is None:
required_confirmations = self.network.required_confirmations

for block in self.poll_blocks(stop_block, required_confirmations, new_block_timeout):
if block.number is None:
raise ValueError("Block number cannot be None")
Expand Down
5 changes: 2 additions & 3 deletions src/ape/contracts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,8 @@ def poll_logs(
Iterator[:class:`~ape.types.ContractLog`]
"""

required_confirmations = (
required_confirmations or self.provider.network.required_confirmations
)
if required_confirmations is None:
required_confirmations = self.provider.network.required_confirmations

# NOTE: We process historical blocks separately here to minimize rpc calls
height = max(self.chain_manager.blocks.height - required_confirmations, 0)
Expand Down
1 change: 1 addition & 0 deletions src/ape/managers/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def poll_blocks(
Returns:
Iterator[:class:`~ape.api.providers.BlockAPI`]
"""

if required_confirmations is None:
required_confirmations = self.network_confirmations

Expand Down

0 comments on commit e808769

Please sign in to comment.