Skip to content

Commit

Permalink
Merge bitcoin#14465: tests: Stop node before removing the notificatio…
Browse files Browse the repository at this point in the history
…n file

ca6d86c tests: Stop node before removing the notification file (Chun Kuan Lee)

Pull request description:

  Stop node before removing the notification file to make sure the
command has been terminated. After then we could removing those files
safely and do not receive any permission error. (See bitcoin#14446)

  The permission error is Windows specific, documented in python doc:
>On Windows, attempting to remove a file that is in use causes an
exception to be raised

  See https://docs.python.org/3/library/os.html#os.remove

Tree-SHA512: fbdabf3a9a838bb59ba207dd9e9fbdd87c702a99ad66bee0b2b1537f80f8630d22d9d5e9c4ded23a82a66bfc10989227fb024b27393425abe0e5a2ad4e4cbb82
  • Loading branch information
5tefan committed Aug 13, 2021
1 parent ded574b commit f9cd7ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/functional/feature_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ def run_test(self):
# directory content should equal the generated transaction hashes
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
assert_equal(sorted(txids_rpc), sorted(os.listdir(self.walletnotify_dir)))
self.stop_node(1)
for tx_file in os.listdir(self.walletnotify_dir):
os.remove(os.path.join(self.walletnotify_dir, tx_file))

self.log.info("test -walletnotify after rescan")
# restart node to rescan to force wallet notifications
self.restart_node(1)
self.start_node(1)
connect_nodes_bi(self.nodes, 0, 1)

wait_until(lambda: len(os.listdir(self.walletnotify_dir)) == block_count, timeout=10)
Expand Down

0 comments on commit f9cd7ff

Please sign in to comment.