MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_wumbo_channels

Function test_wumbo_channels

tests/test_connection.py:3600–3674  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

3598@pytest.mark.openchannel('v1')
3599@pytest.mark.openchannel('v2')
3600def test_wumbo_channels(node_factory, bitcoind):
3601 # l3 is not wumbo.
3602 l1, l2, l3 = node_factory.get_nodes(3, opts=[{}, {}, {'dev-force-features': '-19'}])
3603 conn = l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3604
3605 expected_features = expected_peer_features()
3606 assert conn['features'] == expected_features
3607 assert only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['features'] == expected_features
3608
3609 # Now, can we open a giant channel?
3610 l1.fundwallet(1 << 26)
3611 l1.rpc.fundchannel(l2.info['id'], 1 << 24)
3612
3613 # Get that mined, and announced.
3614 bitcoind.generate_block(6, wait_for_mempool=1)
3615
3616 # Make sure l3 is ready to receive channel announcement!
3617 sync_blockheight(bitcoind, [l1, l2, l3])
3618 # Connect l3, get gossip.
3619 l3.rpc.connect(l1.info['id'], 'localhost', port=l1.port)
3620
3621 # Make sure channel capacity is what we expected (might need to wait for
3622 # both channel updates!
3623 wait_for(lambda: [c['amount_msat'] for c in l3.rpc.listchannels()['channels']]
3624 == [Millisatoshi(str(1 << 24) + "sat")] * 2)
3625
3626 # Make sure channel features are right from channel_announcement
3627 assert ([c['features'] for c in l3.rpc.listchannels()['channels']]
3628 == [expected_channel_features()] * 2)
3629
3630 # Make sure we can't open a wumbo channel if we don't agree.
3631 with pytest.raises(RpcError, match='Amount exceeded'):
3632 l1.rpc.fundchannel(l3.info['id'], 1 << 24)
3633
3634 # But we can open and announce a normal one.
3635 l1.rpc.fundchannel(l3.info['id'], 'all')
3636 bitcoind.generate_block(6, wait_for_mempool=1)
3637 wait_for(lambda: l1.channel_state(l3) == 'CHANNELD_NORMAL')
3638
3639 # Make sure l2 sees correct size.
3640 wait_for(lambda: [c['amount_msat'] for c in l2.rpc.listchannels(l1.get_channel_scid(l3))['channels']]
3641 == [Millisatoshi(str((1 << 24) - 1) + "sat")] * 2)
3642
3643 # Make sure 'all' works with wumbo peers.
3644 l1.rpc.close(l2.info['id'])
3645 bitcoind.generate_block(1, wait_for_mempool=1)
3646 wait_for(lambda: l1.channel_state(l2) == 'ONCHAIN')
3647 wait_for(lambda: l2.channel_state(l1) == 'ONCHAIN')
3648
3649 l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3650 l1.rpc.fundchannel(l2.info['id'], 'all')
3651 bitcoind.generate_block(1, wait_for_mempool=1)
3652 wait_for(lambda: 'CHANNELD_NORMAL' in [c['state'] for c in l1.rpc.listpeerchannels(l2.info['id'])['channels']])
3653 wait_for(lambda: 'CHANNELD_NORMAL' in [c['state'] for c in l2.rpc.listpeerchannels(l1.info['id'])['channels']])
3654
3655 # Exact amount depends on fees, but it will be wumbo!
3656 chan = only_one([c for c in l1.rpc.listpeerchannels(l2.info['id'])['channels'] if c['state'] == 'CHANNELD_NORMAL'])
3657 amount = chan['funding']['local_funds_msat']

Callers

nothing calls this directly

Calls 15

expected_peer_featuresFunction · 0.90
only_oneFunction · 0.90
sync_blockheightFunction · 0.90
wait_forFunction · 0.90
MillisatoshiClass · 0.90
get_nodesMethod · 0.80
fundwalletMethod · 0.80
generate_blockMethod · 0.80
channel_stateMethod · 0.80
get_channel_scidMethod · 0.80
listpeerchannelsMethod · 0.80

Tested by

no test coverage detected