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

Function test_funding_change

tests/test_connection.py:1033–1052  ·  view source on GitHub ↗

Add some funds, fund a channel, and make sure we remember the change

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

1031@pytest.mark.openchannel('v1')
1032@pytest.mark.openchannel('v2')
1033def test_funding_change(node_factory, bitcoind):
1034 """Add some funds, fund a channel, and make sure we remember the change
1035 """
1036 l1, l2 = node_factory.line_graph(2, fundchannel=False)
1037 l1.fundwallet(10000000)
1038 bitcoind.generate_block(1)
1039 sync_blockheight(bitcoind, [l1])
1040
1041 outputs = l1.db_query('SELECT value FROM outputs WHERE status=0;')
1042 assert only_one(outputs)['value'] == 10000000
1043
1044 l1.rpc.fundchannel(l2.info['id'], 1000000)
1045 bitcoind.generate_block(1, wait_for_mempool=1)
1046 sync_blockheight(bitcoind, [l1])
1047 outputs = {r['status']: r['value'] for r in l1.db_query(
1048 'SELECT status, SUM(value) AS value FROM outputs GROUP BY status;')}
1049
1050 # The 10m out is spent and we have a change output of 9m-fee
1051 assert outputs[0] > 8990000
1052 assert outputs[2] == 10000000
1053
1054
1055@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected