Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_notifications.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2014-2019 The Bitcoin Core developers | # Copyright (c) 2014-2019 The Bitcoin Core developers | ||||
# Copyright (c) 2018 The Bitcoin developers | # Copyright (c) 2018 The Bitcoin developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test the -alertnotify, -blocknotify and -walletnotify options.""" | """Test the -alertnotify, -blocknotify and -walletnotify options.""" | ||||
import os | import os | ||||
from test_framework.address import ADDRESS_BCHREG_UNSPENDABLE | from test_framework.address import ADDRESS_BCHREG_UNSPENDABLE | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
connect_nodes_bi, | connect_nodes, | ||||
wait_until | wait_until | ||||
) | ) | ||||
FORK_WARNING_MESSAGE = "Warning: Large-work fork detected, forking after block {}" | FORK_WARNING_MESSAGE = "Warning: Large-work fork detected, forking after block {}" | ||||
class NotificationsTest(BitcoinTestFramework): | class NotificationsTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
os.listdir( | os.listdir( | ||||
self.walletnotify_dir))) | self.walletnotify_dir))) | ||||
for tx_file in os.listdir(self.walletnotify_dir): | for tx_file in os.listdir(self.walletnotify_dir): | ||||
os.remove(os.path.join(self.walletnotify_dir, tx_file)) | os.remove(os.path.join(self.walletnotify_dir, tx_file)) | ||||
self.log.info("test -walletnotify after rescan") | self.log.info("test -walletnotify after rescan") | ||||
# restart node to rescan to force wallet notifications | # restart node to rescan to force wallet notifications | ||||
self.restart_node(1) | self.restart_node(1) | ||||
connect_nodes_bi(self.nodes[0], self.nodes[1]) | connect_nodes(self.nodes[0], self.nodes[1]) | ||||
wait_until( | wait_until( | ||||
lambda: len( | lambda: len( | ||||
os.listdir( | os.listdir( | ||||
self.walletnotify_dir)) == block_count, | self.walletnotify_dir)) == block_count, | ||||
timeout=10) | timeout=10) | ||||
# directory content should equal the generated transaction hashes | # directory content should equal the generated transaction hashes | ||||
Show All 32 Lines |