MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_multifunding_param_failures

Function test_multifunding_param_failures

tests/test_connection.py:2163–2204  ·  view source on GitHub ↗

Test that multifunding handles errors in parameters.

(node_factory)

Source from the content-addressed store, hash-verified

2161
2162
2163def test_multifunding_param_failures(node_factory):
2164 '''
2165 Test that multifunding handles errors in parameters.
2166 '''
2167 l1, l2, l3 = node_factory.get_nodes(3)
2168
2169 l1.fundwallet(1 << 26)
2170
2171 # No connection hint to unconnected node.
2172 destinations = [{"id": '{}'.format(l2.info['id']),
2173 "amount": 50000},
2174 {"id": '{}@localhost:{}'.format(l3.info['id'], l3.port),
2175 "amount": 50000}]
2176 with pytest.raises(RpcError):
2177 l1.rpc.multifundchannel(destinations)
2178
2179 # Duplicated destination.
2180 destinations = [{"id": '{}@localhost:{}'.format(l2.info['id'], l2.port),
2181 "amount": 50000},
2182 {"id": '{}@localhost:{}'.format(l3.info['id'], l3.port),
2183 "amount": 50000},
2184 {"id": '{}@localhost:{}'.format(l2.info['id'], l2.port),
2185 "amount": 50000}]
2186 with pytest.raises(RpcError):
2187 l1.rpc.multifundchannel(destinations)
2188
2189 # Empty destinations.
2190 with pytest.raises(RpcError):
2191 l1.rpc.multifundchannel([])
2192
2193 # Required destination fields missing.
2194 l1.rpc.check_request_schemas = False
2195 destinations = [{"id": '{}@localhost:{}'.format(l2.info['id'], l2.port),
2196 "amount": 50000},
2197 {"id": '{}@localhost:{}'.format(l3.info['id'], l3.port)}]
2198 with pytest.raises(RpcError):
2199 l1.rpc.multifundchannel(destinations)
2200 destinations = [{"amount": 50000},
2201 {"id": '{}@localhost:{}'.format(l3.info['id'], l3.port),
2202 "amount": 50000}]
2203 with pytest.raises(RpcError):
2204 l1.rpc.multifundchannel(destinations)
2205
2206
2207@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 3

get_nodesMethod · 0.80
fundwalletMethod · 0.80
multifundchannelMethod · 0.80

Tested by

no test coverage detected