mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
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 <rusty@rustcorp.com.au>
This commit is contained in:
parent
9fabf614f4
commit
74e960c20b
@ -251,12 +251,12 @@ def test_disconnect_opener(node_factory):
|
|||||||
for d in disconnects:
|
for d in disconnects:
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||||
with pytest.raises(RpcError):
|
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
|
assert l1.rpc.getpeer(l2.info['id']) is None
|
||||||
|
|
||||||
# This one will succeed.
|
# This one will succeed.
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
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!
|
# Should still only have one peer!
|
||||||
assert len(l1.rpc.listpeers()) == 1
|
assert len(l1.rpc.listpeers()) == 1
|
||||||
@ -277,12 +277,12 @@ def test_disconnect_fundee(node_factory):
|
|||||||
for d in disconnects:
|
for d in disconnects:
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||||
with pytest.raises(RpcError):
|
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
|
assert l1.rpc.getpeer(l2.info['id']) is None
|
||||||
|
|
||||||
# This one will succeed.
|
# This one will succeed.
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
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!
|
# Should still only have one peer!
|
||||||
assert len(l1.rpc.listpeers()) == 1
|
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)
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||||
with pytest.raises(RpcError):
|
with pytest.raises(RpcError):
|
||||||
l1.rpc.fundchannel(l2.info['id'], 20000)
|
l1.rpc.fundchannel(l2.info['id'], 25000)
|
||||||
|
|
||||||
# Peer remembers, opener doesn't.
|
# Peer remembers, opener doesn't.
|
||||||
assert l1.rpc.getpeer(l2.info['id']) is None
|
assert l1.rpc.getpeer(l2.info['id']) is None
|
||||||
@ -319,7 +319,7 @@ def test_reconnect_signed(node_factory):
|
|||||||
l1.fundwallet(2000000)
|
l1.fundwallet(2000000)
|
||||||
|
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
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.
|
# They haven't forgotten each other.
|
||||||
assert l1.rpc.getpeer(l2.info['id'])['id'] == l2.info['id']
|
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.
|
# l2 closes on l1, l1 forgets.
|
||||||
with pytest.raises(RpcError):
|
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
|
assert l1.rpc.getpeer(l2.info['id']) is None
|
||||||
|
|
||||||
# Reconnect.
|
# Reconnect.
|
||||||
@ -359,7 +359,7 @@ def test_reconnect_openingd(node_factory):
|
|||||||
l2.daemon.wait_for_log('openingd.*Handed peer, entering loop')
|
l2.daemon.wait_for_log('openingd.*Handed peer, entering loop')
|
||||||
|
|
||||||
# Should work fine.
|
# 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.daemon.wait_for_log('sendrawtx exit 0')
|
||||||
|
|
||||||
l1.bitcoin.generate_block(3)
|
l1.bitcoin.generate_block(3)
|
||||||
|
@ -462,11 +462,11 @@ def test_routing_gossip_reconnect(node_factory):
|
|||||||
{'may_reconnect': True},
|
{'may_reconnect': True},
|
||||||
{}])
|
{}])
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
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
|
# Now open new channels and everybody should sync
|
||||||
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
|
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
|
||||||
l2.openchannel(l3, 20000)
|
l2.openchannel(l3, 25000)
|
||||||
|
|
||||||
# Settle the gossip
|
# Settle the gossip
|
||||||
for n in [l1, l2, l3]:
|
for n in [l1, l2, l3]:
|
||||||
@ -508,7 +508,7 @@ def test_routing_gossip(node_factory, bitcoind):
|
|||||||
for i in range(len(nodes) - 1):
|
for i in range(len(nodes) - 1):
|
||||||
src, dst = nodes[i], nodes[i + 1]
|
src, dst = nodes[i], nodes[i + 1]
|
||||||
src.rpc.connect(dst.info['id'], 'localhost', dst.port)
|
src.rpc.connect(dst.info['id'], 'localhost', dst.port)
|
||||||
src.openchannel(dst, 20000)
|
src.openchannel(dst, 25000)
|
||||||
|
|
||||||
# Allow announce messages.
|
# Allow announce messages.
|
||||||
bitcoind.generate_block(5)
|
bitcoind.generate_block(5)
|
||||||
|
@ -467,7 +467,7 @@ def test_bech32_funding(node_factory, chainparams):
|
|||||||
l1, l2 = node_factory.line_graph(2, opts={'random_hsm': True}, fundchannel=False)
|
l1, l2 = node_factory.line_graph(2, opts={'random_hsm': True}, fundchannel=False)
|
||||||
|
|
||||||
# fund a bech32 address and then open a channel with it
|
# 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']
|
address = res['address']
|
||||||
assert address.startswith(chainparams['bip173_prefix'])
|
assert address.startswith(chainparams['bip173_prefix'])
|
||||||
|
|
||||||
|
@ -1383,7 +1383,7 @@ def test_forward_local_failed_stats(node_factory, bitcoind, executor):
|
|||||||
c12 = l1.fund_channel(l2, 10**6)
|
c12 = l1.fund_channel(l2, 10**6)
|
||||||
c23 = l2.fund_channel(l3, 10**6)
|
c23 = l2.fund_channel(l3, 10**6)
|
||||||
c24 = l2.fund_channel(l4, 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)
|
l6.fund_channel(l1, 10**6)
|
||||||
|
|
||||||
# Make sure routes finalized.
|
# Make sure routes finalized.
|
||||||
|
@ -1211,9 +1211,9 @@ def test_bcli(node_factory, bitcoind, chainparams):
|
|||||||
|
|
||||||
l1.fundwallet(10**5)
|
l1.fundwallet(10**5)
|
||||||
l1.connect(l2)
|
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']})
|
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"))
|
and txo["script"].startswith("0020"))
|
||||||
l1.rpc.close(l2.info["id"])
|
l1.rpc.close(l2.info["id"])
|
||||||
# When output is spent, it should give us null !
|
# When output is spent, it should give us null !
|
||||||
|
Loading…
Reference in New Issue
Block a user