(node_factory)
| 1185 | |
| 1186 | |
| 1187 | def test_fees_dont_exceed_constraints(node_factory): |
| 1188 | msat = 100000000 |
| 1189 | max_msat = int(msat * 0.45) |
| 1190 | # 0 has to use two paths (1 and 2) to reach 3. But we tell it 0->1 has limited capacity. |
| 1191 | gsfile, nodemap = generate_gossip_store([GenChannel(0, 1, capacity_sats=msat // 1000, forward=GenChannel.Half(propfee=10000)), |
| 1192 | GenChannel(0, 2, capacity_sats=msat // 1000, forward=GenChannel.Half(propfee=10000)), |
| 1193 | GenChannel(1, 3, capacity_sats=msat // 1000, forward=GenChannel.Half(propfee=10000)), |
| 1194 | GenChannel(2, 3, capacity_sats=msat // 1000, forward=GenChannel.Half(propfee=10000))]) |
| 1195 | |
| 1196 | # Set up l1 with this as the gossip_store |
| 1197 | l1 = node_factory.get_node(gossip_store_file=gsfile.name) |
| 1198 | |
| 1199 | chan = only_one([c for c in l1.rpc.listchannels(source=nodemap[0])['channels'] if c['destination'] == nodemap[1]]) |
| 1200 | l1.rpc.askrene_create_layer('test_layers') |
| 1201 | l1.rpc.askrene_inform_channel(layer='test_layers', |
| 1202 | short_channel_id_dir=f"{chan['short_channel_id']}/{chan['direction']}", |
| 1203 | amount_msat=max_msat + 1, |
| 1204 | inform='constrained') |
| 1205 | |
| 1206 | routes = l1.rpc.getroutes(source=nodemap[0], |
| 1207 | destination=nodemap[3], |
| 1208 | amount_msat=msat, |
| 1209 | layers=['test_layers'], |
| 1210 | maxfee_msat=msat, |
| 1211 | final_cltv=99)['routes'] |
| 1212 | assert len(routes) == 2 |
| 1213 | for hop in routes[0]['path'] + routes[1]['path']: |
| 1214 | if hop['short_channel_id_dir'] == f"{chan['short_channel_id']}/{chan['direction']}": |
| 1215 | amount = hop['amount_in_msat'] |
| 1216 | assert amount <= max_msat |
| 1217 | |
| 1218 | |
| 1219 | def test_sourcefree_on_mods(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected