-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from pipermerriam/piper/fix-eth_getTransactio…
…n-for-unknown-transaction-hash Fix transaction formatter to handle null
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
from web3.utils.string import force_bytes | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def wait_for_first_block(web3, wait_for_block): | ||
wait_for_block(web3) | ||
|
||
|
||
def test_eth_getTransaction_for_unknown_transaction(web3): | ||
txn_hash = b'0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238' | ||
txn = web3.eth.getTransaction(txn_hash) | ||
assert txn is None | ||
|
||
|
||
def test_eth_getTransaction(web3, extra_accounts, wait_for_transaction): | ||
txn_hash = web3.eth.sendTransaction({ | ||
"from": web3.eth.coinbase, | ||
"to": extra_accounts[1], | ||
"value": 1234, | ||
}) | ||
|
||
wait_for_transaction(web3, txn_hash) | ||
|
||
txn = web3.eth.getTransaction(txn_hash) | ||
assert txn['hash'] == txn_hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters