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

api: make valid_until_block configurable in TxBuilder #310

Merged
merged 1 commit into from
Sep 16, 2024
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
7 changes: 5 additions & 2 deletions neo3/api/helpers/txbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ async def calculate_system_fee(self) -> None:
res = await self.client.invoke_script(self.tx.script, self.tx.signers)
self.tx.system_fee = res.gas_consumed

async def set_valid_until_block(self) -> None:
async def set_valid_until_block(self, blocks: int = 1500) -> None:
"""
Set maximum time the transaction is valid in the mempool. Defaults to about 24h for a network with 15s blocktime.

Args:
blocks: until how many blocks from the current chain height is the transaction valid. Defaults to ~24 hours.
"""
self.tx.valid_until_block = await self.client.get_block_count() + 1500
self.tx.valid_until_block = await self.client.get_block_count() + blocks

async def calculate_network_fee(self) -> None:
"""
Expand Down
Loading