aboutsummaryrefslogtreecommitdiff
path: root/tests/functional_tests/mining.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional_tests/mining.py')
-rwxr-xr-xtests/functional_tests/mining.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py
index 5c14d34fd..b8b9e0959 100755
--- a/tests/functional_tests/mining.py
+++ b/tests/functional_tests/mining.py
@@ -46,7 +46,8 @@ class MiningTest():
def run_test(self):
self.reset()
self.create()
- self.mine()
+ self.mine(True)
+ self.mine(False)
def reset(self):
print('Resetting blockchain')
@@ -62,8 +63,8 @@ class MiningTest():
except: pass
res = wallet.restore_deterministic_wallet(seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted')
- def mine(self):
- print("Test mining")
+ def mine(self, via_daemon):
+ print("Test mining via " + ("daemon" if via_daemon else "wallet"))
daemon = Daemon()
wallet = Wallet()
@@ -76,7 +77,10 @@ class MiningTest():
res_status = daemon.mining_status()
- res = daemon.start_mining('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', threads_count = 1)
+ if via_daemon:
+ res = daemon.start_mining('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', threads_count = 1)
+ else:
+ res = wallet.start_mining(threads_count = 1)
res_status = daemon.mining_status()
assert res_status.active == True
@@ -101,7 +105,11 @@ class MiningTest():
timeout -= 1
assert timeout >= 0
- res = daemon.stop_mining()
+ if via_daemon:
+ res = daemon.stop_mining()
+ else:
+ res = wallet.stop_mining()
+
res_status = daemon.mining_status()
assert res_status.active == False
@@ -113,7 +121,10 @@ class MiningTest():
balance = res_getbalance.balance
assert balance >= prev_balance + (new_height - prev_height) * 600000000000
- res = daemon.start_mining('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', threads_count = 1, do_background_mining = True)
+ if via_daemon:
+ res = daemon.start_mining('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', threads_count = 1, do_background_mining = True)
+ else:
+ res = wallet.start_mining(threads_count = 1, do_background_mining = True)
res_status = daemon.mining_status()
assert res_status.active == True
assert res_status.threads_count == 1
@@ -122,7 +133,10 @@ class MiningTest():
assert res_status.block_reward >= 600000000000
# don't wait, might be a while if the machine is busy, which it probably is
- res = daemon.stop_mining()
+ if via_daemon:
+ res = daemon.stop_mining()
+ else:
+ res = wallet.stop_mining()
res_status = daemon.mining_status()
assert res_status.active == False