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