lightningd: enable io logging on subdaemons iff we're going to print it.

This simplifies our tests, too, since we don't need a magic option to
enable io logging in subdaemons.

Note that test_bad_onion still takes too long, due to a separate minor
bug, so that's marked and left dev-only for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-11-18 10:57:17 +10:30
parent 0607f998d1
commit 4fc498f901
7 changed files with 40 additions and 52 deletions

View File

@@ -1811,9 +1811,9 @@ def test_funder_simple_reconnect(node_factory, bitcoind):
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "sqlite3-specific DB rollback")
@unittest.skipIf(not DEVELOPER, "needs LIGHTNINGD_DEV_LOG_IO")
def test_dataloss_protection(node_factory, bitcoind):
l1 = node_factory.get_node(may_reconnect=True, log_all_io=True,
l1 = node_factory.get_node(may_reconnect=True, options={'log-level': 'io'},
feerates=(7500, 7500, 7500))
l2 = node_factory.get_node(may_reconnect=True, log_all_io=True,
l2 = node_factory.get_node(may_reconnect=True, options={'log-level': 'io'},
feerates=(7500, 7500, 7500), allow_broken_log=True)
lf = expected_features()

View File

@@ -123,9 +123,6 @@ def test_announce_address(node_factory, bitcoind):
scid = l1.fund_channel(l2, 10**6)
bitcoind.generate_block(5)
# Activate IO logging for l1.
subprocess.run(['kill', '-USR1', l1.subd_pid('channeld')])
l1.wait_channel_active(scid)
l2.wait_channel_active(scid)
@@ -483,12 +480,6 @@ def test_gossip_no_empty_announcements(node_factory, bitcoind):
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
l3.rpc.connect(l4.info['id'], 'localhost', l4.port)
# Turn on IO logging for openingd (make sure it's ready!)
l1.daemon.wait_for_log('openingd-.*: Handed peer, entering loop')
subprocess.run(['kill', '-USR1', l1.subd_pid('openingd')])
l2.daemon.wait_for_log(r'{}-.*openingd-chan #.: Handed peer, entering loop'.format(l3.info['id']))
subprocess.run(['kill', '-USR1', l2.subd_pid('openingd', l3.info['id'])])
# Make an announced-but-not-updated channel.
l3.fund_channel(l4, 10**5)
bitcoind.generate_block(5)
@@ -1021,7 +1012,7 @@ def test_gossip_store_load_amount_truncated(node_factory):
def test_node_reannounce(node_factory, bitcoind):
"Test that we reannounce a node when parameters change"
l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True,
'log_all_io': True})
'log-level': 'io'})
bitcoind.generate_block(5)
# Wait for node_announcement for l1.
@@ -1100,9 +1091,6 @@ def test_gossip_notices_close(node_factory, bitcoind):
allow_bad_gossip=True)
l2, l3 = node_factory.line_graph(2)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# FIXME: sending SIGUSR1 immediately may kill it before handler installed.
l1.daemon.wait_for_log('Handed peer, entering loop')
subprocess.run(['kill', '-USR1', l1.subd_pid('openingd')])
bitcoind.generate_block(5)
@@ -1527,7 +1515,7 @@ def test_gossip_no_backtalk(node_factory):
l1, l2 = node_factory.line_graph(2, wait_for_announce=True)
# This connects, gets gossip, but should *not* play it back.
l3 = node_factory.get_node(log_all_io=True)
l3 = node_factory.get_node(options={'log-level': 'io'})
l3.rpc.connect(l2.info['id'], 'localhost', l2.port)
# Will get channel_announce, then two channel_update and two node_announcement

View File

@@ -658,9 +658,6 @@ def test_io_logging(node_factory, executor):
pid2 = l2.subd_pid('channeld')
l2.daemon.wait_for_log(' to CHANNELD_NORMAL')
# Send it sigusr1: should turn on logging.
subprocess.run(['kill', '-USR1', pid1])
fut = executor.submit(l1.pay, l2, 200000000)
# WIRE_UPDATE_ADD_HTLC = 128 = 0x0080
@@ -1194,9 +1191,6 @@ def test_htlc_send_timeout(node_factory, bitcoind):
l1.fund_channel(l2, 10**6)
chanid2 = l2.fund_channel(l3, 10**6)
subprocess.run(['kill', '-USR1', l1.subd_pid('channeld')])
subprocess.run(['kill', '-USR1', l2.subd_pid('channeld')])
# Make sure channels get announced.
bitcoind.generate_block(5)
@@ -1453,11 +1447,11 @@ def test_check_command(node_factory):
sock.close()
@unittest.skipIf(not DEVELOPER, "need log_all_io")
@unittest.skipIf(not DEVELOPER, "FIXME: without DEVELOPER=1 we timeout")
def test_bad_onion(node_factory, bitcoind):
"""Test that we get a reasonable error from sendpay when an onion is bad"""
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True,
opts={'log_all_io': True})
opts={'log-level': 'io'})
h = l4.rpc.invoice(123000, 'test_bad_onion', 'description')['payment_hash']
route = l1.rpc.getroute(l4.info['id'], 123000, 1)['route']