Add some funds, fund a channel, and make sure we remember the change
(node_factory, bitcoind)
| 977 | @pytest.mark.openchannel('v1') |
| 978 | @pytest.mark.openchannel('v2') |
| 979 | def 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') |
nothing calls this directly
no test coverage detected