Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential returning account state twice: first from block, then from blockchain states #460

Open
dmugtasimov opened this issue Oct 24, 2021 · 0 comments

Comments

@dmugtasimov
Copy link
Contributor

    def yield_account_states(self, from_block_number: Optional[int] = None):
        # TODO(dmu) HIGH: Reuse this method where possible
        block_number = self.get_last_block_number() if from_block_number is None else from_block_number
        if block_number == -1:
            yield from self.get_first_blockchain_state().yield_account_states()
            return

        blockchain_state = self.get_blockchain_state_by_block_number(block_number, inclusive=True)
        for block in self.yield_blocks_slice_reversed(block_number, blockchain_state.last_block_number):
            yield from block.yield_account_states()

        yield from blockchain_state.yield_account_states()
@dmugtasimov dmugtasimov changed the title Fix potential returning account state twice: first from block, then from account states Fix potential returning account state twice: first from block, then from blockchain states Oct 24, 2021
@dmugtasimov dmugtasimov added this to the Fundamental features milestone Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants