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

Function test_wumbo_channels

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

Source from the content-addressed store, hash-verified

3408@pytest.mark.openchannel('v1')
3409@pytest.mark.openchannel('v2')
3410def test_wumbo_channels(node_factory, bitcoind):
3411 l1, l2, l3 = node_factory.get_nodes(3,
3412 opts=[{'large-channels': None},
3413 {'large-channels': None},
3414 {}])
3415 conn = l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3416
3417 expected_features = expected_peer_features(wumbo_channels=True)
3418 if l1.config('experimental-dual-fund'):
3419 expected_features = expected_peer_features(wumbo_channels=True,
3420 extra=[21, 29])
3421
3422 assert conn['features'] == expected_features
3423 assert only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['features'] == expected_features
3424
3425 # Now, can we open a giant channel?
3426 l1.fundwallet(1 << 26)
3427 l1.rpc.fundchannel(l2.info['id'], 1 << 24)
3428
3429 # Get that mined, and announced.
3430 bitcoind.generate_block(6, wait_for_mempool=1)
3431
3432 # Connect l3, get gossip.
3433 l3.rpc.connect(l1.info['id'], 'localhost', port=l1.port)
3434
3435 # Make sure channel capacity is what we expected (might need to wait for
3436 # both channel updates!
3437 wait_for(lambda: [c['amount_msat'] for c in l3.rpc.listchannels()['channels']]
3438 == [Millisatoshi(str(1 << 24) + "sat")] * 2)
3439
3440 # Make sure channel features are right from channel_announcement
3441 assert ([c['features'] for c in l3.rpc.listchannels()['channels']]
3442 == [expected_channel_features(wumbo_channels=True)] * 2)
3443
3444 # Make sure we can't open a wumbo channel if we don't agree.
3445 with pytest.raises(RpcError, match='Amount exceeded'):
3446 l1.rpc.fundchannel(l3.info['id'], 1 << 24)
3447
3448 # But we can open and announce a normal one.
3449 l1.rpc.fundchannel(l3.info['id'], 'all')
3450 bitcoind.generate_block(6, wait_for_mempool=1)
3451 wait_for(lambda: l1.channel_state(l3) == 'CHANNELD_NORMAL')
3452
3453 # Make sure l2 sees correct size.
3454 wait_for(lambda: [c['amount_msat'] for c in l2.rpc.listchannels(l1.get_channel_scid(l3))['channels']]
3455 == [Millisatoshi(str((1 << 24) - 1) + "sat")] * 2)
3456
3457 # Make sure 'all' works with wumbo peers.
3458 l1.rpc.close(l2.info['id'])
3459 bitcoind.generate_block(1, wait_for_mempool=1)
3460 wait_for(lambda: l1.channel_state(l2) == 'ONCHAIN')
3461
3462 l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3463 l1.rpc.fundchannel(l2.info['id'], 'all')
3464 bitcoind.generate_block(1, wait_for_mempool=1)
3465 wait_for(lambda: 'CHANNELD_NORMAL' in [c['state'] for c in only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels']])
3466
3467 # Exact amount depends on fees, but it will be wumbo!

Callers

nothing calls this directly

Calls 15

expected_peer_featuresFunction · 0.90
only_oneFunction · 0.90
wait_forFunction · 0.90
MillisatoshiClass · 0.90
get_nodesMethod · 0.80
configMethod · 0.80
fundwalletMethod · 0.80
generate_blockMethod · 0.80
channel_stateMethod · 0.80
get_channel_scidMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected