(node_factory, bitcoind)
| 2042 | |
| 2043 | |
| 2044 | def test_close_72_block_delay(node_factory, bitcoind): |
| 2045 | l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True) |
| 2046 | |
| 2047 | # Close l1-l2 |
| 2048 | txid = only_one(l1.rpc.close(l2.info['id'])['txids']) |
| 2049 | bitcoind.generate_block(1, txid) |
| 2050 | |
| 2051 | # But l4 doesn't believe it immediately. |
| 2052 | l4.daemon.wait_for_log("channel .* closing soon due to the funding outpoint being spent") |
| 2053 | |
| 2054 | # Close l2-l3 one block later. |
| 2055 | txid = only_one(l2.rpc.close(l3.info['id'])['txids']) |
| 2056 | bitcoind.generate_block(1, txid) |
| 2057 | l4.daemon.wait_for_log("channel .* closing soon due to the funding outpoint being spent") |
| 2058 | |
| 2059 | # BOLT #7: |
| 2060 | # - once its funding output has been spent OR reorganized out: |
| 2061 | # - SHOULD forget a channel after a 72-block delay. |
| 2062 | |
| 2063 | # That implies 72 blocks *after* spending, i.e. 73 blocks deep! |
| 2064 | |
| 2065 | # 72 blocks deep, l4 still sees it |
| 2066 | bitcoind.generate_block(70) |
| 2067 | sync_blockheight(bitcoind, [l4]) |
| 2068 | assert len(l4.rpc.listchannels(source=l1.info['id'])['channels']) == 1 |
| 2069 | |
| 2070 | # 73 blocks deep does it. |
| 2071 | bitcoind.generate_block(1) |
| 2072 | wait_for(lambda: l4.rpc.listchannels(source=l1.info['id'])['channels'] == []) |
| 2073 | |
| 2074 | # Other channel still visible. |
| 2075 | assert len(l4.rpc.listchannels(source=l2.info['id'])['channels']) == 1 |
| 2076 | |
| 2077 | # Restart: it remembers channel is dying. |
| 2078 | l4.restart() |
| 2079 | |
| 2080 | # One more block, it's forgotten too. |
| 2081 | bitcoind.generate_block(1) |
| 2082 | wait_for(lambda: l4.rpc.listchannels(source=l2.info['id'])['channels'] == []) |
| 2083 | |
| 2084 | |
| 2085 | def test_gossip_not_dying(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected