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

Function test_setchannel_all

tests/test_pay.py:2507–2558  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

2505
2506
2507def test_setchannel_all(node_factory, bitcoind):
2508 # TEST SETUP
2509 #
2510 # [l1]----> [l2]
2511 # |
2512 # o-----> [l3]
2513 DEF_BASE = 10
2514 DEF_PPM = 100
2515
2516 l1, l2, l3 = node_factory.get_nodes(3, opts={'fee-base': DEF_BASE, 'fee-per-satoshi': DEF_PPM})
2517 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2518 l1.rpc.connect(l3.info['id'], 'localhost', l3.port)
2519 l1.fundchannel(l2, 1000000)
2520 l1.fundchannel(l3, 1000000)
2521
2522 # get short channel id
2523 scid2 = l1.get_channel_scid(l2)
2524 scid3 = l1.get_channel_scid(l3)
2525
2526 # now try to set all (two) channels using wildcard syntax
2527 result = l1.rpc.setchannel("all", 0xDEAD, 0xBEEF, 0xBAD, 0xCAFE)
2528
2529 channel_after = {"htlc_minimum_msat": Millisatoshi(0xBAD),
2530 "htlc_maximum_msat": Millisatoshi(0xCAFE),
2531 "cltv_expiry_delta": 6,
2532 "fee_base_msat": Millisatoshi(0xDEAD),
2533 "fee_proportional_millionths": 0xBEEF}
2534
2535 # We should see these updates immediately.
2536 assert only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['updates']['local'] == channel_after
2537 assert only_one(l1.rpc.listpeerchannels(l3.info['id'])['channels'])['updates']['local'] == channel_after
2538
2539 # Peer should see them soon (once we sent)
2540 wait_for(lambda: only_one(l2.rpc.listpeerchannels()['channels'])['updates']['remote'] == channel_after)
2541 wait_for(lambda: only_one(l3.rpc.listpeerchannels()['channels'])['updates']['remote'] == channel_after)
2542
2543 # Don't assume order!
2544 assert len(result['channels']) == 2
2545 if result['channels'][0]['peer_id'] == l3.info['id']:
2546 result['channels'] = [result['channels'][1], result['channels'][0]]
2547 assert result['channels'][0]['peer_id'] == l2.info['id']
2548 assert result['channels'][0]['short_channel_id'] == scid2
2549 assert result['channels'][0]['fee_base_msat'] == 0xDEAD
2550 assert result['channels'][0]['fee_proportional_millionths'] == 0xBEEF
2551 assert result['channels'][0]['minimum_htlc_out_msat'] == 0xBAD
2552 assert result['channels'][0]['maximum_htlc_out_msat'] == 0xCAFE
2553 assert result['channels'][1]['peer_id'] == l3.info['id']
2554 assert result['channels'][1]['short_channel_id'] == scid3
2555 assert result['channels'][1]['fee_base_msat'] == 0xDEAD
2556 assert result['channels'][1]['fee_proportional_millionths'] == 0xBEEF
2557 assert result['channels'][1]['minimum_htlc_out_msat'] == 0xBAD
2558 assert result['channels'][1]['maximum_htlc_out_msat'] == 0xCAFE
2559
2560
2561def test_setchannel_startup_opts(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 9

MillisatoshiClass · 0.90
only_oneFunction · 0.90
wait_forFunction · 0.90
get_nodesMethod · 0.80
get_channel_scidMethod · 0.80
setchannelMethod · 0.80
listpeerchannelsMethod · 0.80
connectMethod · 0.45
fundchannelMethod · 0.45

Tested by

no test coverage detected