add stop_node argument to check_node_log, use it in shieldingcoinbase

This commit is contained in:
Alfredo Garcia 2020-03-10 14:13:35 -03:00
parent 1aae365438
commit 1485c596e7
3 changed files with 12 additions and 18 deletions

View File

@ -495,10 +495,11 @@ def get_coinbase_address(node, expected_utxos=None):
assert(len(addrs) > 0)
return addrs[0]
def check_node_log(self, node_number, line_to_check):
def check_node_log(self, node_number, line_to_check, stop_node = True):
print("Checking node " + str(node_number) + " logs")
self.nodes[node_number].stop()
bitcoind_processes[node_number].wait()
if stop_node:
self.nodes[node_number].stop()
bitcoind_processes[node_number].wait()
logpath = self.options.tmpdir + "/node" + str(node_number) + "/regtest/debug.log"
foundErrorMsg = False
with open(logpath, "r") as myfile:

View File

@ -166,10 +166,8 @@ class TurnstileTest (BitcoinTestFramework):
string_to_find1 = "ConnectBlock(): turnstile violation in " + POOL_NAME.capitalize() + " shielded value pool"
string_to_find2 = "InvalidChainFound: invalid block="
string_to_find3 = "ConnectTip(): ConnectBlock " + newhash + " failed"
check_node_log(self, 0, string_to_find1)
self.start_and_sync_node(0)
check_node_log(self, 0, string_to_find2)
self.start_and_sync_node(0)
check_node_log(self, 0, string_to_find1, False)
check_node_log(self, 0, string_to_find2, False)
check_node_log(self, 0, string_to_find3)
self.start_and_sync_node(0)

View File

@ -8,7 +8,8 @@ from test_framework.authproxy import JSONRPCException
from test_framework.mininode import COIN
from test_framework.util import assert_equal, initialize_chain_clean, \
start_nodes, connect_nodes_bi, wait_and_assert_operationid_status, \
wait_and_assert_operationid_status_result, get_coinbase_address
wait_and_assert_operationid_status_result, get_coinbase_address, \
check_node_log
import sys
import timeit
@ -153,17 +154,11 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
assert_equal("Invalid parameter, spending key for address does not belong to wallet" in errorString, True)
# Verify that debug=zrpcunsafe logs params, and that full txid is associated with opid
logpath = self.options.tmpdir+"/node0/regtest/debug.log"
logcounter = 0
with open(logpath, "r") as myfile:
logdata = myfile.readlines()
for logline in logdata:
if myopid + ": z_sendmany initialized" in logline and mytaddr in logline and myzaddr in logline:
assert_equal(logcounter, 0) # verify order of log messages
logcounter = logcounter + 1
if myopid + ": z_sendmany finished" in logline and mytxid in logline:
assert_equal(logcounter, 1)
logcounter = logcounter + 1
check_node_log(self, 0, myopid + ": z_sendmany initialized", False)
logcounter = logcounter + 1
check_node_log(self, 0, myopid + ": z_sendmany finished", False)
logcounter = logcounter + 1
assert_equal(logcounter, 2)
# check balances (the z_sendmany consumes 3 coinbase utxos)