Skip to content

Commit

Permalink
fix: off-by-one error
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Feb 22, 2023
1 parent d52efb8 commit 723ef84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ape/managers/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def outgoing(self) -> Iterator[ReceiptAPI]:
"""

start_nonce = 0
stop_nonce = self.__len__() # just to cache this value
stop_nonce = self.__len__() - 1 # just to cache this value

# TODO: Add ephemeral network sessional history to `ape-cache` instead,
# and remove this (replace with `yield from iter(self[:len(self)])`)
Expand All @@ -424,7 +424,7 @@ def outgoing(self) -> Iterator[ReceiptAPI]:

if receipt.nonce > start_nonce:
# NOTE: There's a gap in our sessional history, so fetch from query engine
yield from iter(self[start_nonce : receipt.nonce]) # noqa: E203
yield from iter(self[start_nonce : receipt.nonce + 1]) # noqa: E203

yield receipt
start_nonce = receipt.nonce + 1 # start next loop on the next item
Expand Down

0 comments on commit 723ef84

Please sign in to comment.