Test disconnection during multifundchannel
(node_factory)
| 2006 | |
| 2007 | @pytest.mark.openchannel('v1') |
| 2008 | def test_multifunding_disconnect(node_factory): |
| 2009 | ''' |
| 2010 | Test disconnection during multifundchannel |
| 2011 | ''' |
| 2012 | # TODO: Note that -WIRE_FUNDING_SIGNED does not |
| 2013 | # work. |
| 2014 | # See test_disconnect_half_signed. |
| 2015 | # If disconnected when the peer believes it sent |
| 2016 | # WIRE_FUNDING_SIGNED but before we actually |
| 2017 | # receive it, the peer continues to monitor our |
| 2018 | # funding tx, but we have forgotten it and will |
| 2019 | # never send it. |
| 2020 | disconnects = ["-WIRE_INIT", |
| 2021 | "-WIRE_ACCEPT_CHANNEL", |
| 2022 | "+WIRE_ACCEPT_CHANNEL"] |
| 2023 | l1, l2, l3 = node_factory.get_nodes(3, opts=[{'dev-no-reconnect': None}, |
| 2024 | {'dev-no-reconnect': None, |
| 2025 | 'disconnect': disconnects}, |
| 2026 | {'dev-no-reconnect': None}]) |
| 2027 | |
| 2028 | l1.fundwallet(2000000) |
| 2029 | |
| 2030 | destinations = [{"id": '{}@localhost:{}'.format(l2.info['id'], l2.port), |
| 2031 | "amount": 50000}, |
| 2032 | {"id": '{}@localhost:{}'.format(l3.info['id'], l3.port), |
| 2033 | "amount": 50000}] |
| 2034 | |
| 2035 | # Funding to l2 will fail, and we should properly |
| 2036 | # inform l3 to back out as well. |
| 2037 | for d in disconnects: |
| 2038 | with pytest.raises(RpcError): |
| 2039 | l1.rpc.multifundchannel(destinations) |
| 2040 | wait_for(lambda: l1.rpc.listpeers(l2.info['id'])['peers'] == []) |
| 2041 | |
| 2042 | # TODO: failing at the fundchannel_complete phase |
| 2043 | # (-WIRE_FUNDING_SIGNED +-WIRE_FUNDING_SIGNED) |
| 2044 | # leaves the peer (l2 in this case) in a state |
| 2045 | # where it is waiting for an incoming channel, |
| 2046 | # even though we no longer have a channel going to |
| 2047 | # that peer. |
| 2048 | # Reconnecting with the peer will clear up that |
| 2049 | # confusion, but then the peer will disconnect |
| 2050 | # after a random amount of time. |
| 2051 | |
| 2052 | destinations = [{"id": '{}@localhost:{}'.format(l3.info['id'], l3.port), |
| 2053 | "amount": 50000}] |
| 2054 | |
| 2055 | # This should succeed. |
| 2056 | l1.rpc.multifundchannel(destinations) |
| 2057 | |
| 2058 | |
| 2059 | @pytest.mark.openchannel('v1') |
nothing calls this directly
no test coverage detected