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

Function test_funding_all

tests/test_connection.py:1064–1083  ·  view source on GitHub ↗

Add some funds, fund a channel using all funds, make sure no funds remain

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

1062@pytest.mark.openchannel('v1')
1063@pytest.mark.openchannel('v2')
1064def test_funding_all(node_factory, bitcoind):
1065 """Add some funds, fund a channel using all funds, make sure no funds remain
1066 """
1067 l1, l2 = node_factory.line_graph(2, fundchannel=False)
1068
1069 l1.fundwallet(0.1 * 10**8)
1070 bitcoind.generate_block(1)
1071 sync_blockheight(bitcoind, [l1])
1072
1073 outputs = l1.db_query('SELECT value FROM outputs WHERE status=0;')
1074 assert only_one(outputs)['value'] == 10000000
1075
1076 l1.rpc.fundchannel(l2.info['id'], "all")
1077
1078 # Keeps emergency reserve!
1079 outputs = l1.db_query('SELECT value FROM outputs WHERE status=0;')
1080 if 'anchors/even' in only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['names']:
1081 assert outputs == [{'value': 25000}]
1082 else:
1083 assert outputs == []
1084
1085
1086@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 8

sync_blockheightFunction · 0.90
only_oneFunction · 0.90
line_graphMethod · 0.80
fundwalletMethod · 0.80
generate_blockMethod · 0.80
db_queryMethod · 0.80
listpeerchannelsMethod · 0.80
fundchannelMethod · 0.45

Tested by

no test coverage detected