From b35dc4689bf5164ea5a196e441cef74ca6cc1d43 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 7 Aug 2019 14:14:54 +0930 Subject: [PATCH] pytest: enable deprecated APIs for multi-arg closes. We're about to change the API, so this makes the tests still work across the transition (and, as a bonus, tests our backwards compat shim). Signed-off-by: Rusty Russell --- tests/test_closing.py | 12 ++++++------ tests/test_connection.py | 9 +++++---- tests/test_pay.py | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/test_closing.py b/tests/test_closing.py index a5a622343..8c7a934a4 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -13,7 +13,7 @@ import unittest @unittest.skipIf(not DEVELOPER, "Too slow without --dev-bitcoind-poll") def test_closing(node_factory, bitcoind): - l1, l2 = node_factory.line_graph(2) + l1, l2 = node_factory.line_graph(2, opts={'allow-deprecated-apis': True}) chan = l1.get_channel_scid(l2) l1.pay(l2, 200000000) @@ -98,7 +98,7 @@ def test_closing(node_factory, bitcoind): def test_closing_while_disconnected(node_factory, bitcoind): - l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True}) + l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True, 'allow-deprecated-apis': True}) chan = l1.get_channel_scid(l2) l1.pay(l2, 200000000) @@ -147,7 +147,7 @@ def test_closing_id(node_factory): @unittest.skipIf(not DEVELOPER, "needs dev-rescan-outputs") def test_closing_torture(node_factory, executor, bitcoind): - l1, l2 = node_factory.get_nodes(2) + l1, l2 = node_factory.get_nodes(2, opts={'allow-deprecated-apis': True}) amount = 10**6 # Before the fix was applied, 15 would often pass. @@ -197,7 +197,7 @@ def test_closing_torture(node_factory, executor, bitcoind): @unittest.skipIf(SLOW_MACHINE and VALGRIND, "slow test") def test_closing_different_fees(node_factory, bitcoind, executor): - l1 = node_factory.get_node() + l1 = node_factory.get_node(options={'allow-deprecated-apis': True}) # Default feerate = 15000/7500/1000 # It will start at the second number, accepting anything above the first. @@ -215,7 +215,7 @@ def test_closing_different_fees(node_factory, bitcoind, executor): peers = [] for feerate in feerates: for amount in amounts: - p = node_factory.get_node(feerates=feerate) + p = node_factory.get_node(feerates=feerate, options={'allow-deprecated-apis': True}) p.feerate = feerate p.amount = amount l1.rpc.connect(p.info['id'], 'localhost', p.port) @@ -265,7 +265,7 @@ def test_closing_negotiation_reconnect(node_factory, bitcoind): disconnects = ['-WIRE_CLOSING_SIGNED', '@WIRE_CLOSING_SIGNED', '+WIRE_CLOSING_SIGNED'] - l1 = node_factory.get_node(disconnect=disconnects, may_reconnect=True) + l1 = node_factory.get_node(disconnect=disconnects, may_reconnect=True, options={'allow-deprecated-apis': True}) l2 = node_factory.get_node(may_reconnect=True) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) diff --git a/tests/test_connection.py b/tests/test_connection.py index ac64a3046..57d82068a 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -577,7 +577,8 @@ def test_shutdown_reconnect(node_factory): '@WIRE_SHUTDOWN', '+WIRE_SHUTDOWN'] l1 = node_factory.get_node(disconnect=disconnects, - may_reconnect=True) + may_reconnect=True, + options={'allow-deprecated-apis': True}) l2 = node_factory.get_node(may_reconnect=True) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) @@ -637,7 +638,7 @@ def test_reconnect_remote_sends_no_sigs(node_factory): def test_shutdown_awaiting_lockin(node_factory, bitcoind): - l1 = node_factory.get_node() + l1 = node_factory.get_node(options={'allow-deprecated-apis': True}) l2 = node_factory.get_node(options={'funding-confirms': 3}) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) @@ -1128,7 +1129,7 @@ def test_channel_reenable(node_factory): @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") def test_update_fee(node_factory, bitcoind): - l1, l2 = node_factory.line_graph(2, fundchannel=True) + l1, l2 = node_factory.line_graph(2, fundchannel=True, opts={'allow-deprecated-apis': True}) chanid = l1.get_channel_scid(l2) # Make l1 send out feechange. @@ -1312,7 +1313,7 @@ def test_forget_channel(node_factory): def test_peerinfo(node_factory, bitcoind): - l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True}) + l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True, 'allow-deprecated-apis': True}) lfeatures = 'aa' # Gossiping but no node announcement yet assert l1.rpc.getpeer(l2.info['id'])['connected'] diff --git a/tests/test_pay.py b/tests/test_pay.py index 19ff7160e..dd738364a 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -1165,7 +1165,7 @@ def test_forward_local_failed_stats(node_factory, bitcoind, executor): disconnects = ['-WIRE_UPDATE_FAIL_HTLC', 'permfail'] l1 = node_factory.get_node() - l2 = node_factory.get_node() + l2 = node_factory.get_node(options={'allow-deprecated-apis': True}) l3 = node_factory.get_node() l4 = node_factory.get_node(disconnect=disconnects) l5 = node_factory.get_node() @@ -1824,7 +1824,7 @@ def test_setchannelfee_state(node_factory, bitcoind): l0 = node_factory.get_node(options={'fee-base': DEF_BASE, 'fee-per-satoshi': DEF_PPM}) l1 = node_factory.get_node(options={'fee-base': DEF_BASE, 'fee-per-satoshi': DEF_PPM}) - l2 = node_factory.get_node(options={'fee-base': DEF_BASE, 'fee-per-satoshi': DEF_PPM}) + l2 = node_factory.get_node(options={'fee-base': DEF_BASE, 'fee-per-satoshi': DEF_PPM, 'allow-deprecated-apis': True}) # connection and funding l0.rpc.connect(l1.info['id'], 'localhost', l1.port)