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/broadcaster sequence number initialization #252

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pyinjective/core/broadcaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,12 @@ def new_for_grantee_account_without_simulation(
return instance

async def broadcast(self, messages: List[any_pb2.Any]):
await self._client.sync_timeout_height()
await self._client.get_account(self._account_config.trading_injective_address)
# Only force initialization of timeout_height and account info (number and sequence) if they are not initialized
# Done this way to allow users to handle timeout_height and sequence re-synchronization in case of errors
if self._client.timeout_height == 1:
await self._client.sync_timeout_height()
if self._client.number == 0:
await self._client.get_account(self._account_config.trading_injective_address)

messages_for_transaction = self._account_config.messages_prepared_for_transaction(messages=messages)

Expand Down
Loading