Skip to content

Commit

Permalink
tests/test_gossip.py: Add test to check that duplicated exclusions in…
Browse files Browse the repository at this point in the history
… `getroute` have no lasting effect.
  • Loading branch information
ZmnSCPxj authored and cdecker committed Aug 2, 2019
1 parent 359433f commit a5fb372
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,31 @@ def test_gossip_notices_close(node_factory, bitcoind):
assert(l1.rpc.listnodes()['nodes'] == [])


@pytest.mark.xfail(strict=True)
def test_getroute_exclude_duplicate(node_factory):
"""Test that accidentally duplicating the same channel in
the exclude list will not have permanent effects.
"""

l1, l2 = node_factory.line_graph(2, wait_for_announce=True)

# Starting route
route = l1.rpc.getroute(l2.info['id'], 1, 1)['route']
# l1 id is > l2 id, so 1 means l1->l2
chan_l1l2 = route[0]['channel'] + '/1'

# This should fail to find a route as the only viable channel
# is excluded, and worse, is excluded twice.
with pytest.raises(RpcError):
l1.rpc.getroute(l2.info['id'], 1, 1, exclude=[chan_l1l2, chan_l1l2])

# This should still succeed since nothing is excluded anymore
# and in particular should return the exact same route as
# earlier.
route2 = l1.rpc.getroute(l2.info['id'], 1, 1)['route']
assert route == route2


@unittest.skipIf(not DEVELOPER, "gossip propagation is slow without DEVELOPER=1")
def test_getroute_exclude(node_factory, bitcoind):
"""Test getroute's exclude argument"""
Expand Down

0 comments on commit a5fb372

Please sign in to comment.