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

Function test_getroutes_fee_fallback

tests/test_askrene.py:984–1027  ·  view source on GitHub ↗

Test getroutes call takes into account fees, if excessive

(node_factory)

Source from the content-addressed store, hash-verified

982
983
984def test_getroutes_fee_fallback(node_factory):
985 """Test getroutes call takes into account fees, if excessive"""
986
987 # 0 -> 1 -> 3: high capacity, high fee (1%)
988 # 0 -> 2 -> 3: low capacity, low fee.
989 # (We disable reverse, since it breaks median calc!)
990 gsfile, nodemap = generate_gossip_store([GenChannel(0, 1,
991 capacity_sats=20000,
992 forward=GenChannel.Half(propfee=10000),
993 reverse=GenChannel.Half(enabled=False)),
994 GenChannel(0, 2,
995 capacity_sats=10000,
996 reverse=GenChannel.Half(enabled=False)),
997 GenChannel(1, 3,
998 capacity_sats=20000,
999 forward=GenChannel.Half(propfee=10000),
1000 reverse=GenChannel.Half(enabled=False)),
1001 GenChannel(2, 3,
1002 capacity_sats=10000,
1003 reverse=GenChannel.Half(enabled=False))])
1004 # Set up l1 with this as the gossip_store
1005 l1 = node_factory.get_node(gossip_store_file=gsfile.name)
1006
1007 # Don't hit maxfee? Go easy path.
1008 dir01 = direction(nodemap[0], nodemap[1])
1009 dir13 = direction(nodemap[1], nodemap[3])
1010 dir02 = direction(nodemap[0], nodemap[2])
1011 dir23 = direction(nodemap[2], nodemap[3])
1012 check_getroute_paths(l1,
1013 nodemap[0],
1014 nodemap[3],
1015 10000,
1016 maxfee_msat=201,
1017 paths=[[{'short_channel_id_dir': f'0x1x0/{dir01}'},
1018 {'short_channel_id_dir': f'3x3x2/{dir13}'}]])
1019
1020 # maxfee exceeded? lower prob path.
1021 check_getroute_paths(l1,
1022 nodemap[0],
1023 nodemap[3],
1024 10000,
1025 maxfee_msat=200,
1026 paths=[[{'short_channel_id_dir': f'1x2x1/{dir02}'},
1027 {'short_channel_id_dir': f'5x3x3/{dir23}'}]])
1028
1029
1030def test_getroutes_auto_sourcefree(node_factory):

Callers

nothing calls this directly

Calls 5

generate_gossip_storeFunction · 0.90
GenChannelClass · 0.90
check_getroute_pathsFunction · 0.85
directionFunction · 0.70
get_nodeMethod · 0.45

Tested by

no test coverage detected