Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_dbcrash.py
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | def restart_node(self, node_index, expected_tip): | ||||
while time.time() - time_start < 120: | while time.time() - time_start < 120: | ||||
try: | try: | ||||
# Any of these RPC calls could throw due to node crash | # Any of these RPC calls could throw due to node crash | ||||
self.start_node(node_index) | self.start_node(node_index) | ||||
self.nodes[node_index].waitforblock(expected_tip) | self.nodes[node_index].waitforblock(expected_tip) | ||||
utxo_hash = self.nodes[node_index].gettxoutsetinfo()[ | utxo_hash = self.nodes[node_index].gettxoutsetinfo()[ | ||||
'hash_serialized'] | 'hash_serialized'] | ||||
return utxo_hash | return utxo_hash | ||||
except: | except Exception: | ||||
# An exception here should mean the node is about to crash. | # An exception here should mean the node is about to crash. | ||||
# If bitcoind exits, then try again. wait_for_node_exit() | # If bitcoind exits, then try again. wait_for_node_exit() | ||||
# should raise an exception if bitcoind doesn't exit. | # should raise an exception if bitcoind doesn't exit. | ||||
self.wait_for_node_exit(node_index, timeout=15) | self.wait_for_node_exit(node_index, timeout=15) | ||||
self.crashed_on_restart += 1 | self.crashed_on_restart += 1 | ||||
time.sleep(1) | time.sleep(1) | ||||
# If we got here, bitcoind isn't coming back up on restart. Could be a | # If we got here, bitcoind isn't coming back up on restart. Could be a | ||||
▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines |