ape
ape copied to clipboard
Add `start_block` and `stop_block` to AccountHistory query
Overview
Currently, chain.account_history
is in efficient because it check the entire account history every time you do a lookup.
If we add the start_block
and stop_block
to get_account_transactions()
, we can avoid checking unnecessary transactions and possibly avoiding HTTP calls.
Specification
def get_account_transactions(self, address: AddressType, start_block: int = 0, stop_block: Optional[int] = None) -> Iterator["ReceiptAPI"]:
and then have AccountHistory
track the block number and only request in the new block range on each subsequent call
Dependencies
Include links to any open issues that must be resolved before this feature can be implemented.
A side issue to this: The receipts map is updated from the explorer in __getitem__
but not in __iter__
or items()
, which is strange, it should probably keep in sync in all of them... but to loop through the explorer history that many times is not good either.