Skip to content

Commit

Permalink
Start/stop miner for replaceTransaction_already_mined test
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Jan 15, 2020
1 parent 95e8022 commit d330c5c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/generate_go_ethereum_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
valmap,
)

from tests.utils import (
from utils import (
get_open_port,
)
from web3 import Web3
Expand Down
9 changes: 6 additions & 3 deletions tests/integration/go_ethereum/test_goethereum_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def geth_command_arguments(rpc_port,
(
'--rpc',
'--rpcport', rpc_port,
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,web3',
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner',
'--ipcdisable',
'--allow-insecure-unlock',
)
Expand All @@ -52,7 +52,7 @@ def geth_command_arguments(rpc_port,
(
'--rpc',
'--rpcport', rpc_port,
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,web3',
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner',
'--ipcdisable',
)
)
Expand Down Expand Up @@ -92,7 +92,10 @@ def test_admin_stopRPC(web3):


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
def test_eth_replaceTransaction_already_mined(self, web3, unlocked_account_dual_type):
web3.geth.miner.start()
super().test_eth_replaceTransaction_already_mined(web3, unlocked_account_dual_type)
web3.geth.miner.stop()


class TestGoEthereumVersionModuleTest(GoEthereumVersionModuleTest):
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/go_ethereum/test_goethereum_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def test_admin_peers(web3):


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
def test_eth_replaceTransaction_already_mined(self, web3, unlocked_account_dual_type):
web3.geth.miner.start()
super().test_eth_replaceTransaction_already_mined(web3, unlocked_account_dual_type)
web3.geth.miner.stop()


class TestGoEthereumVersionModuleTest(GoEthereumVersionModuleTest):
Expand Down
9 changes: 6 additions & 3 deletions tests/integration/go_ethereum/test_goethereum_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def geth_command_arguments(geth_binary,
(
'--ws',
'--wsport', ws_port,
'--wsapi', 'admin,db,eth,net,shh,web3,personal,web3',
'--wsapi', 'admin,db,eth,net,shh,web3,personal,miner',
'--wsorigins', '*',
'--ipcdisable',
'--allow-insecure-unlock',
Expand All @@ -56,7 +56,7 @@ def geth_command_arguments(geth_binary,
(
'--ws',
'--wsport', ws_port,
'--wsapi', 'admin,db,eth,net,shh,web3,personal,web3',
'--wsapi', 'admin,db,eth,net,shh,web3,personal,miner',
'--wsorigins', '*',
'--ipcdisable',
)
Expand Down Expand Up @@ -97,7 +97,10 @@ def test_admin_stopWS(self, web3):


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
def test_eth_replaceTransaction_already_mined(self, web3, unlocked_account_dual_type):
web3.geth.miner.start()
super().test_eth_replaceTransaction_already_mined(web3, unlocked_account_dual_type)
web3.geth.miner.stop()


class TestGoEthereumVersionModuleTest(GoEthereumVersionModuleTest):
Expand Down
2 changes: 1 addition & 1 deletion web3/_utils/module_testing/eth_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ def test_eth_replaceTransaction_non_existing_transaction(
txn_params
)

# auto mine is enabled for this test
def test_eth_replaceTransaction_already_mined(
self, web3: "Web3", unlocked_account_dual_type: ChecksumAddress
) -> None:
Expand All @@ -475,6 +474,7 @@ def test_eth_replaceTransaction_already_mined(
'gasPrice': web3.eth.gasPrice,
}
txn_hash = web3.eth.sendTransaction(txn_params)
web3.eth.waitForTransactionReceipt(txn_hash)

txn_params['gasPrice'] = Wei(web3.eth.gasPrice * 2)
with pytest.raises(ValueError, match="Supplied transaction with hash"):
Expand Down

0 comments on commit d330c5c

Please sign in to comment.