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

Function test_funding_change

tests/test_connection.py:979–998  ·  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

977@pytest.mark.openchannel('v1')
978@pytest.mark.openchannel('v2')
979def test_funding_change(node_factory, bitcoind):
980 """Add some funds, fund a channel, and make sure we remember the change
981 """
982 l1, l2 = node_factory.line_graph(2, fundchannel=False)
983 l1.fundwallet(10000000)
984 bitcoind.generate_block(1)
985 sync_blockheight(bitcoind, [l1])
986
987 outputs = l1.db_query('SELECT value FROM outputs WHERE status=0;')
988 assert only_one(outputs)['value'] == 10000000
989
990 l1.rpc.fundchannel(l2.info['id'], 1000000)
991 bitcoind.generate_block(1, wait_for_mempool=1)
992 sync_blockheight(bitcoind, [l1])
993 outputs = {r['status']: r['value'] for r in l1.db_query(
994 'SELECT status, SUM(value) AS value FROM outputs GROUP BY status;')}
995
996 # The 10m out is spent and we have a change output of 9m-fee
997 assert outputs[0] > 8990000
998 assert outputs[2] == 10000000
999
1000
1001@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