@@ -552,22 +552,26 @@ def test_getroutes(node_factory):
552552 'delay' : 99 + 6 }]])
553553
554554
555- @pytest .mark .skip
556555def test_getroutes_fee_fallback (node_factory ):
557556 """Test getroutes call takes into account fees, if excessive"""
558557
559558 # 0 -> 1 -> 3: high capacity, high fee (1%)
560559 # 0 -> 2 -> 3: low capacity, low fee.
560+ # (We disable reverse, since it breaks median calc!)
561561 gsfile , nodemap = generate_gossip_store ([GenChannel (0 , 1 ,
562562 capacity_sats = 20000 ,
563- forward = GenChannel .Half (propfee = 10000 )),
563+ forward = GenChannel .Half (propfee = 10000 ),
564+ reverse = GenChannel .Half (enabled = False )),
564565 GenChannel (0 , 2 ,
565- capacity_sats = 10000 ),
566+ capacity_sats = 10000 ,
567+ reverse = GenChannel .Half (enabled = False )),
566568 GenChannel (1 , 3 ,
567569 capacity_sats = 20000 ,
568- forward = GenChannel .Half (propfee = 10000 )),
570+ forward = GenChannel .Half (propfee = 10000 ),
571+ reverse = GenChannel .Half (enabled = False )),
569572 GenChannel (2 , 3 ,
570- capacity_sats = 10000 )])
573+ capacity_sats = 10000 ,
574+ reverse = GenChannel .Half (enabled = False ))])
571575 # Set up l1 with this as the gossip_store
572576 l1 = node_factory .get_node (gossip_store_file = gsfile .name )
573577
@@ -1204,6 +1208,13 @@ def amount_through_chan(chan, routes):
12041208 amount_after = amount_through_chan (chan , route2 ['routes' ])
12051209 if amount_after < amount_before :
12061210 num_changed [bias ] += 1
1211+ else :
1212+ # We bias -4 against 83x88x31908/0 going to node 83, and this is violated.
1213+ # Both routes contain three paths, all via 83x88x31908/0.
1214+ # The first amounts 49490584, 1018832, 49490584,
1215+ # The second amounts 25254708, 25254708, 49490584,
1216+ # Due to fees and rounding, we actually spend 1msat more on the second case!
1217+ assert (n , bias , chan ) == (83 , 4 , '83x88x31908/0' )
12071218
12081219 # Undo bias
12091220 l1 .rpc .askrene_bias_channel (layer = 'biases' , short_channel_id_dir = chan , bias = 0 )
0 commit comments