|
1 | 1 | import pytest |
2 | 2 | from integration_tests.test_framework.test_framework import ConfluxTestFramework |
3 | | -from integration_tests.test_framework.util import * |
4 | | -from eth_utils import decode_hex |
| 3 | +from integration_tests.test_framework.util import assert_equal |
5 | 4 | from integration_tests.conflux.rpc import RpcClient |
6 | 5 | from integration_tests.test_framework.blocktools import encode_hex_0x |
7 | 6 |
|
@@ -31,18 +30,29 @@ def test_cross_space_transfer(cw3, ew3, erc20_contract, evm_accounts, network): |
31 | 30 | epoch = receipt["epochNumber"] |
32 | 31 | ret = network.nodes[0].debug_getTransactionsByEpoch(hex(epoch)) |
33 | 32 | assert_equal(len(ret), 1) |
34 | | - |
35 | | -def test_tx_and_receipt(ew3, evm_accounts, receiver_account, network): |
| 33 | + |
| 34 | +@pytest.fixture(scope="module") |
| 35 | +def tx_hash(ew3, evm_accounts, receiver_account): |
36 | 36 | account = evm_accounts[0] |
37 | | - nonce = ew3.eth.get_transaction_count(account.address) |
38 | 37 | tx_hash = ew3.eth.send_transaction({ |
39 | 38 | "from": account.address, |
40 | 39 | "to": receiver_account.address, |
41 | 40 | "value": ew3.to_wei(1, "ether"), |
42 | 41 | "gasPrice": 1, |
43 | 42 | "gas": 21000, |
44 | | - "nonce": nonce, |
45 | 43 | }) |
| 44 | + ew3.eth.wait_for_transaction_receipt(tx_hash) |
| 45 | + return tx_hash |
| 46 | + |
| 47 | +def test_tx_data(ew3, tx_hash, receiver_account): |
| 48 | + data = ew3.eth.get_transaction(tx_hash) |
| 49 | + assert data["gasPrice"] == 1 |
| 50 | + assert data["gas"] == 21000 |
| 51 | + assert data["to"] == receiver_account.address |
| 52 | + assert data["value"] == ew3.to_wei(1, "ether") |
| 53 | + |
| 54 | + |
| 55 | +def test_tx_and_receipt(ew3, network, tx_hash): |
46 | 56 | receipt = ew3.eth.wait_for_transaction_receipt(tx_hash) |
47 | 57 | assert receipt["status"] == 1 |
48 | 58 | assert receipt["gasUsed"] == 21000 |
|
0 commit comments