@@ -1939,7 +1939,16 @@ def listpays_nofail(b11):
19391939
19401940@pytest .mark .slow_test
19411941def test_pay_routeboost (node_factory , bitcoind ):
1942- """Make sure we can use routeboost information. """
1942+ """Make sure we can use routeboost information.
1943+
1944+ ```dot
1945+ graph {
1946+ l1 -- l2 -- l3
1947+ l3 -- l4 [style="dotted"]
1948+ l4 -- l5 [style="dotted"]
1949+ }
1950+ ```
1951+ """
19431952 # l1->l2->l3--private-->l4
19441953 l1 , l2 = node_factory .line_graph (2 , announce_channels = True , wait_for_announce = True )
19451954 l3 , l4 , l5 = node_factory .line_graph (3 , announce_channels = False , wait_for_announce = False )
@@ -2016,10 +2025,24 @@ def test_pay_routeboost(node_factory, bitcoind):
20162025 assert 'success' in attempts [0 ]
20172026
20182027 # Finally, it should fall back to second routehint if first fails.
2019- # (Note, this is not public because it's not 6 deep)
2028+ # (Note, this is not public because it's not 6 deep). To test this
2029+ # we add another edge to the graph, resulting in:
2030+ #
2031+ # ```dot
2032+ # graph {
2033+ # rankdir=LR
2034+ # l1 -- l2 -- l3
2035+ # l4 [label="l4 (offline)",style="dashed"]
2036+ # l3 -- l4 [style="dotted"]
2037+ # l4 -- l5 [style="dotted"]
2038+ # l3 -- l5 [style="dotted"]
2039+ # }
2040+ # ```
20202041 l3 .rpc .connect (l5 .info ['id' ], 'localhost' , l5 .port )
20212042 scid35 , _ = l3 .fundchannel (l5 , 10 ** 6 )
20222043 l4 .stop ()
2044+
2045+ # Now that we have the channels ready, let's build the routehints through l3l5
20232046 routel3l5 = [{'id' : l3 .info ['id' ],
20242047 'short_channel_id' : scid35 ,
20252048 'fee_base_msat' : 1000 ,
@@ -2040,10 +2063,11 @@ def test_pay_routeboost(node_factory, bitcoind):
20402063 assert 'local_exclusions' not in only_one (status ['pay' ])
20412064 attempts = only_one (status ['pay' ])['attempts' ]
20422065
2043- # First one fails, second one succeeds, no routehint would come last.
2044- assert len (attempts ) == 2
2066+ # First routehint in the invoice fails, we may retry that one
2067+ # unsuccessfully before switching, hence the >2 instead of =2
2068+ assert len (attempts ) >= 2
20452069 assert 'success' not in attempts [0 ]
2046- assert 'success' in attempts [1 ]
2070+ assert 'success' in attempts [- 1 ]
20472071 # TODO Add assertion on the routehint once we add them to the pay
20482072 # output
20492073
0 commit comments