Onchain handling where opener immediately drops to chain
(node_factory, bitcoind)
| 1797 | |
| 1798 | |
| 1799 | def test_onchain_first_commit(node_factory, bitcoind): |
| 1800 | """Onchain handling where opener immediately drops to chain""" |
| 1801 | |
| 1802 | # We track channel balances, to verify that accounting is ok. |
| 1803 | coin_mvt_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py') |
| 1804 | |
| 1805 | # HTLC 1->2, 1 fails just after funding. |
| 1806 | disconnects = ['+WIRE_CHANNEL_READY', 'permfail'] |
| 1807 | # Make locktime different, as we once had them reversed! |
| 1808 | l1, l2 = node_factory.line_graph(2, opts=[{'disconnect': disconnects, |
| 1809 | 'plugin': coin_mvt_plugin}, |
| 1810 | {'watchtime-blocks': 10, |
| 1811 | 'plugin': coin_mvt_plugin}], |
| 1812 | fundchannel=False) |
| 1813 | l1.fundwallet(10**7) |
| 1814 | l1.rpc.fundchannel(l2.info['id'], 10**6) |
| 1815 | l1.daemon.wait_for_log('sendrawtx exit 0') |
| 1816 | |
| 1817 | bitcoind.generate_block(1) |
| 1818 | |
| 1819 | # l1 will drop to chain. |
| 1820 | l1.daemon.wait_for_log('permfail') |
| 1821 | l1.daemon.wait_for_log('sendrawtx exit 0') |
| 1822 | bitcoind.generate_block(1) |
| 1823 | l1.daemon.wait_for_log(' to ONCHAIN') |
| 1824 | l2.daemon.wait_for_log(' to ONCHAIN') |
| 1825 | |
| 1826 | _, txid, blocks = l1.wait_for_onchaind_tx('OUR_DELAYED_RETURN_TO_WALLET', |
| 1827 | 'OUR_UNILATERAL/DELAYED_OUTPUT_TO_US') |
| 1828 | assert blocks == 9 |
| 1829 | |
| 1830 | # 10 later, l1 should collect its to-self payment. |
| 1831 | bitcoind.generate_block(9) |
| 1832 | |
| 1833 | # 94 later, l2 is done. |
| 1834 | bitcoind.generate_block(94, wait_for_mempool=txid) |
| 1835 | l2.daemon.wait_for_log('onchaind complete, forgetting peer') |
| 1836 | |
| 1837 | # Now, 100 blocks and l1 should be done. |
| 1838 | bitcoind.generate_block(6) |
| 1839 | l1.daemon.wait_for_log('onchaind complete, forgetting peer') |
| 1840 | |
| 1841 | |
| 1842 | def test_onchain_unwatch(node_factory, bitcoind, chainparams): |
nothing calls this directly
no test coverage detected