We lazily delete htlcs from channel_htlcs table
(node_factory, bitcoind)
| 2566 | |
| 2567 | |
| 2568 | def test_old_htlcs_cleanup(node_factory, bitcoind): |
| 2569 | """We lazily delete htlcs from channel_htlcs table""" |
| 2570 | l1, l2 = node_factory.line_graph(2) |
| 2571 | |
| 2572 | for _ in range(10): |
| 2573 | l1.pay(l2, 1000) |
| 2574 | |
| 2575 | l1.rpc.close(l2.info['id']) |
| 2576 | bitcoind.generate_block(100, wait_for_mempool=1) |
| 2577 | wait_for(lambda: l1.rpc.listpeerchannels() == {'channels': []}) |
| 2578 | # We don't see them! |
| 2579 | assert l1.rpc.listhtlcs() == {'htlcs': []} |
| 2580 | |
| 2581 | l1.stop() |
| 2582 | # They're still there. |
| 2583 | assert l1.db_query('SELECT COUNT(*) as c FROM channel_htlcs')[0]['c'] == 10 |
| 2584 | |
| 2585 | l1.start() |
| 2586 | # Now they're not |
| 2587 | assert l1.db_query('SELECT COUNT(*) as c FROM channel_htlcs')[0]['c'] == 0 |
| 2588 | assert l1.rpc.listhtlcs() == {'htlcs': []} |
| 2589 | |
| 2590 | |
| 2591 | @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Makes use of the sqlite3 db") |
nothing calls this directly
no test coverage detected