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

Fix occasional mining test failure #8450

Merged
merged 2 commits into from
Aug 23, 2022
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 src/wallet/wallet_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3254,7 +3254,7 @@ namespace tools
if (!m_wallet) return not_open(er);
cryptonote::COMMAND_RPC_STOP_MINING::request daemon_req;
cryptonote::COMMAND_RPC_STOP_MINING::response daemon_res;
bool r = m_wallet->invoke_http_json("/stop_mining", daemon_req, daemon_res);
bool r = m_wallet->invoke_http_json("/stop_mining", daemon_req, daemon_res, std::chrono::seconds(60)); // this waits till stopped, and if randomx has just started initializing its dataset, it might be a while
if (!r || daemon_res.status != CORE_RPC_STATUS_OK)
{
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
Expand Down
2 changes: 2 additions & 0 deletions tests/functional_tests/functional_tests_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
os.environ['MAKE_TEST_SIGNATURE'] = FUNCTIONAL_TESTS_DIRECTORY + '/make_test_signature'
os.environ['SEEDHASH_EPOCH_BLOCKS'] = "8"
os.environ['SEEDHASH_EPOCH_LAG'] = "4"
if not 'MINING_SILENT' in os.environ:
os.environ['MINING_SILENT'] = "1"

for i in range(len(command_lines)):
#print('Running: ' + str(command_lines[i]))
Expand Down
4 changes: 2 additions & 2 deletions tests/functional_tests/mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def get_available_ram(self):
available_ram = util_resources.available_ram_gb()
threshold_ram = 3
self.print_mining_info("Available RAM = " + str(round(available_ram, 1)) + " GB")
if available_ram < threshold_ram:
if available_ram < threshold_ram and not self.is_mining_silent():
print("Warning! Available RAM =", round(available_ram, 1),
"GB is less than the reasonable threshold =", threshold_ram,
". The RX init might exceed the calculated timeout.")
Expand Down Expand Up @@ -255,7 +255,7 @@ def submitblock(self):
assert res.hash == block_hash

def is_mining_silent(self):
return 'MINING_SILENT' in os.environ
return 'MINING_SILENT' in os.environ and os.environ['MINING_SILENT'] != "0"

def print_mining_info(self, msg):
if self.is_mining_silent():
Expand Down