Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_notifications.py
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.tx_filename).st_size >= (block_count * 65), timeout=10) | self.tx_filename).st_size >= (block_count * 65), timeout=10) | ||||
# file content should equal the generated transaction hashes | # file content should equal the generated transaction hashes | ||||
txids_rpc = list( | txids_rpc = list( | ||||
map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count))) | map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count))) | ||||
with open(self.tx_filename, 'r') as f: | with open(self.tx_filename, 'r') as f: | ||||
assert_equal(sorted(txids_rpc), sorted(f.read().splitlines())) | assert_equal(sorted(txids_rpc), sorted(f.read().splitlines())) | ||||
# Mine another 41 up-version blocks. -alertnotify should trigger on the 51st. | # TODO: add test for `-alertnotify` large fork notifications | ||||
jasonbcox: Can you double check this? `feature_notifications.py` should be testing `-alertnotify`, so this… | |||||
markblundebergAuthorUnsubmitted Done Inline ActionsYes that's right, at least for ABC -- we added a test of invalid large-work fork in D1951 (the code that comes after this). Though we don't have tests for valid large-work fork notification. Core still doesn't have such any such test for either purpose. markblundeberg: Yes that's right, at least for ABC -- we added a test of invalid large-work fork in D1951 (the… | |||||
self.log.info("test -alertnotify for bip9") | |||||
self.nodes[1].generate(41) | |||||
self.sync_all() | |||||
# Give bitcoind 10 seconds to write the alert notification | |||||
wait_until(lambda: os.path.isfile(self.alert_filename) | |||||
and os.path.getsize(self.alert_filename), timeout=10) | |||||
with open(self.alert_filename, 'r', encoding='utf8') as f: | |||||
alert_text = f.read() | |||||
# Mine more up-version blocks, should not get more alerts: | |||||
self.nodes[1].generate(2) | |||||
self.sync_all() | |||||
with open(self.alert_filename, 'r', encoding='utf8') as f: | |||||
alert_text2 = f.read() | |||||
os.remove(self.alert_filename) | |||||
self.log.info( | |||||
"-alertnotify should not continue notifying for more unknown version blocks") | |||||
assert_equal(alert_text, alert_text2) | |||||
# Create an invalid chain and ensure the node warns. | # Create an invalid chain and ensure the node warns. | ||||
self.log.info("test -alertnotify for forked chain") | self.log.info("test -alertnotify for forked chain") | ||||
fork_block = self.nodes[0].getbestblockhash() | fork_block = self.nodes[0].getbestblockhash() | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
invalid_block = self.nodes[0].getbestblockhash() | invalid_block = self.nodes[0].getbestblockhash() | ||||
self.nodes[0].generate(7) | self.nodes[0].generate(7) | ||||
Show All 14 Lines |
Can you double check this? feature_notifications.py should be testing -alertnotify, so this comment is likely out of date (or just out of orderly backported).