From 74e960c20ba34edd2398c202f49c736ddb74e663 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 25 Aug 2020 14:16:35 +0930 Subject: [PATCH] pytest: increase channel sizes so they reach min capacity with option_anchor_outputs With a feerate of 7500perkw and subtracting 660 sats for anchors, a 20,000 sat channel has capacity about 9800 sat, below our default: You gave bad parameters: channel capacity with funding 20000sat, reserves 546sat/546sat, max_htlc_value_in_flight_msat is 18446744073709551615msat, channel capacity is 9818sat, which is below 10000000msat So bump channel amounts. Signed-off-by: Rusty Russell --- tests/test_connection.py | 16 ++++++++-------- tests/test_gossip.py | 6 +++--- tests/test_misc.py | 2 +- tests/test_pay.py | 2 +- tests/test_plugin.py | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index 18adb29b2..844138011 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -251,12 +251,12 @@ def test_disconnect_opener(node_factory): for d in disconnects: l1.rpc.connect(l2.info['id'], 'localhost', l2.port) with pytest.raises(RpcError): - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) assert l1.rpc.getpeer(l2.info['id']) is None # This one will succeed. l1.rpc.connect(l2.info['id'], 'localhost', l2.port) - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) # Should still only have one peer! assert len(l1.rpc.listpeers()) == 1 @@ -277,12 +277,12 @@ def test_disconnect_fundee(node_factory): for d in disconnects: l1.rpc.connect(l2.info['id'], 'localhost', l2.port) with pytest.raises(RpcError): - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) assert l1.rpc.getpeer(l2.info['id']) is None # This one will succeed. l1.rpc.connect(l2.info['id'], 'localhost', l2.port) - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) # Should still only have one peer! assert len(l1.rpc.listpeers()) == 1 @@ -301,7 +301,7 @@ def test_disconnect_half_signed(node_factory): l1.rpc.connect(l2.info['id'], 'localhost', l2.port) with pytest.raises(RpcError): - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) # Peer remembers, opener doesn't. assert l1.rpc.getpeer(l2.info['id']) is None @@ -319,7 +319,7 @@ def test_reconnect_signed(node_factory): l1.fundwallet(2000000) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) # They haven't forgotten each other. assert l1.rpc.getpeer(l2.info['id'])['id'] == l2.info['id'] @@ -348,7 +348,7 @@ def test_reconnect_openingd(node_factory): # l2 closes on l1, l1 forgets. with pytest.raises(RpcError): - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) assert l1.rpc.getpeer(l2.info['id']) is None # Reconnect. @@ -359,7 +359,7 @@ def test_reconnect_openingd(node_factory): l2.daemon.wait_for_log('openingd.*Handed peer, entering loop') # Should work fine. - l1.rpc.fundchannel(l2.info['id'], 20000) + l1.rpc.fundchannel(l2.info['id'], 25000) l1.daemon.wait_for_log('sendrawtx exit 0') l1.bitcoin.generate_block(3) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 562056ce3..cb527f119 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -462,11 +462,11 @@ def test_routing_gossip_reconnect(node_factory): {'may_reconnect': True}, {}]) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) - l1.openchannel(l2, 20000) + l1.openchannel(l2, 25000) # Now open new channels and everybody should sync l2.rpc.connect(l3.info['id'], 'localhost', l3.port) - l2.openchannel(l3, 20000) + l2.openchannel(l3, 25000) # Settle the gossip for n in [l1, l2, l3]: @@ -508,7 +508,7 @@ def test_routing_gossip(node_factory, bitcoind): for i in range(len(nodes) - 1): src, dst = nodes[i], nodes[i + 1] src.rpc.connect(dst.info['id'], 'localhost', dst.port) - src.openchannel(dst, 20000) + src.openchannel(dst, 25000) # Allow announce messages. bitcoind.generate_block(5) diff --git a/tests/test_misc.py b/tests/test_misc.py index 9e3cfd0ef..a6ecd03c2 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -467,7 +467,7 @@ def test_bech32_funding(node_factory, chainparams): l1, l2 = node_factory.line_graph(2, opts={'random_hsm': True}, fundchannel=False) # fund a bech32 address and then open a channel with it - res = l1.openchannel(l2, 20000, 'bech32') + res = l1.openchannel(l2, 25000, 'bech32') address = res['address'] assert address.startswith(chainparams['bip173_prefix']) diff --git a/tests/test_pay.py b/tests/test_pay.py index f544bd394..bbdc1f568 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -1383,7 +1383,7 @@ def test_forward_local_failed_stats(node_factory, bitcoind, executor): c12 = l1.fund_channel(l2, 10**6) c23 = l2.fund_channel(l3, 10**6) c24 = l2.fund_channel(l4, 10**6) - c25 = l2.fund_channel(l5, 10**4 * 2) + c25 = l2.fund_channel(l5, 10**4 * 3) l6.fund_channel(l1, 10**6) # Make sure routes finalized. diff --git a/tests/test_plugin.py b/tests/test_plugin.py index d52e6340d..b2772d5da 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1211,9 +1211,9 @@ def test_bcli(node_factory, bitcoind, chainparams): l1.fundwallet(10**5) l1.connect(l2) - fc = l1.rpc.fundchannel(l2.info["id"], 10**4 * 2) + fc = l1.rpc.fundchannel(l2.info["id"], 10**4 * 3) txo = l1.rpc.call("getutxout", {"txid": fc['txid'], "vout": fc['outnum']}) - assert (Millisatoshi(txo["amount"]) == Millisatoshi(10**4 * 2 * 10**3) + assert (Millisatoshi(txo["amount"]) == Millisatoshi(10**4 * 3 * 10**3) and txo["script"].startswith("0020")) l1.rpc.close(l2.info["id"]) # When output is spent, it should give us null !