Skip to content

Commit c431552

Browse files
committed
Start/stop miner for replaceTransaction_already_mined test
1 parent 120ea59 commit c431552

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

tests/generate_go_ethereum_fixture.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
valmap,
2727
)
2828

29-
from tests.utils import (
29+
from utils import (
3030
get_open_port,
3131
)
3232
from web3 import Web3

tests/integration/go_ethereum/test_goethereum_http.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def geth_command_arguments(rpc_port,
4141
(
4242
'--rpc',
4343
'--rpcport', rpc_port,
44-
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,web3',
44+
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner',
4545
'--ipcdisable',
4646
'--allow-insecure-unlock',
4747
)
@@ -52,7 +52,7 @@ def geth_command_arguments(rpc_port,
5252
(
5353
'--rpc',
5454
'--rpcport', rpc_port,
55-
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,web3',
55+
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner',
5656
'--ipcdisable',
5757
)
5858
)

tests/integration/go_ethereum/test_goethereum_ws.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def geth_command_arguments(geth_binary,
4444
(
4545
'--ws',
4646
'--wsport', ws_port,
47-
'--wsapi', 'admin,db,eth,net,shh,web3,personal,web3',
47+
'--wsapi', 'admin,db,eth,net,shh,web3,personal,miner',
4848
'--wsorigins', '*',
4949
'--ipcdisable',
5050
'--allow-insecure-unlock',
@@ -56,7 +56,7 @@ def geth_command_arguments(geth_binary,
5656
(
5757
'--ws',
5858
'--wsport', ws_port,
59-
'--wsapi', 'admin,db,eth,net,shh,web3,personal,web3',
59+
'--wsapi', 'admin,db,eth,net,shh,web3,personal,miner',
6060
'--wsorigins', '*',
6161
'--ipcdisable',
6262
)

web3/_utils/module_testing/eth_module.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,11 @@ def test_eth_replaceTransaction_non_existing_transaction(
463463
txn_params
464464
)
465465

466-
# auto mine is enabled for this test
467466
def test_eth_replaceTransaction_already_mined(
468467
self, web3: "Web3", unlocked_account_dual_type: ChecksumAddress
469468
) -> None:
469+
if 'v1.9.7' in web3.clientVersion:
470+
web3.geth.miner.start()
470471
txn_params: TxParams = {
471472
'from': unlocked_account_dual_type,
472473
'to': unlocked_account_dual_type,
@@ -475,10 +476,13 @@ def test_eth_replaceTransaction_already_mined(
475476
'gasPrice': web3.eth.gasPrice,
476477
}
477478
txn_hash = web3.eth.sendTransaction(txn_params)
479+
web3.eth.waitForTransactionReceipt(txn_hash)
478480

479481
txn_params['gasPrice'] = Wei(web3.eth.gasPrice * 2)
480482
with pytest.raises(ValueError, match="Supplied transaction with hash"):
481483
web3.eth.replaceTransaction(txn_hash, txn_params)
484+
if 'v1.9.7' in web3.clientVersion:
485+
web3.geth.miner.stop()
482486

483487
def test_eth_replaceTransaction_incorrect_nonce(
484488
self, web3: "Web3", unlocked_account: ChecksumAddress

0 commit comments

Comments
 (0)