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

export poll_latency #1453

Merged
merged 2 commits into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/web3.eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ The following methods are available on the ``web3.eth`` namespace.
})


.. py:method:: Eth.waitForTransactionReceipt(transaction_hash, timeout=120)
.. py:method:: Eth.waitForTransactionReceipt(transaction_hash, timeout=120, poll_latency=0.1)

Waits for the transaction specified by ``transaction_hash`` to be included in a block, then
returns its transaction receipt.
Expand Down
1 change: 1 addition & 0 deletions newsfragments/1453.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add poll_latency to waitForTransactionReceipt
2 changes: 1 addition & 1 deletion web3/_utils/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def fill_transaction_defaults(web3, transaction):
return merge(defaults, transaction)


def wait_for_transaction_receipt(web3, txn_hash, timeout=120, poll_latency=0.1):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pipermerriam is there any reason to keep the defaults here? The only place this method is used is in eth.waitForTransactionReceipt

def wait_for_transaction_receipt(web3, txn_hash, timeout, poll_latency):
with Timeout(timeout) as _timeout:
while True:
try:
Expand Down
4 changes: 2 additions & 2 deletions web3/eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ def getTransactionByBlock(self, block_identifier, transaction_index):
)
return result

def waitForTransactionReceipt(self, transaction_hash, timeout=120):
def waitForTransactionReceipt(self, transaction_hash, timeout=120, poll_latency=0.1):
try:
return wait_for_transaction_receipt(self.web3, transaction_hash, timeout)
return wait_for_transaction_receipt(self.web3, transaction_hash, timeout, poll_latency)
except Timeout:
raise TimeExhausted(
"Transaction {} is not in the chain, after {} seconds".format(
Expand Down