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

Function test_pay_remember_hint

tests/test_pay.py:6273–6303  ·  view source on GitHub ↗

Using a diamond graph, with inferred `channel_hint`s, see if we remember

(node_factory)

Source from the content-addressed store, hash-verified

6271
6272
6273def test_pay_remember_hint(node_factory):
6274 """Using a diamond graph, with inferred `channel_hint`s, see if we remember
6275 """
6276 sender, fw1, fw2, recipient, = diamond_network(node_factory)
6277
6278 inv = recipient.rpc.invoice(
6279 4200000,
6280 "lbl1",
6281 "desc1",
6282 exposeprivatechannels=[], # suppress routehints, so fees alone control route
6283 )['bolt11']
6284
6285 p = sender.rpc.pay(inv)
6286
6287 # Ensure we failed the first, cheap, path, and then tried the successful one.
6288 assert(p['parts'] == 2)
6289
6290 # Now for the final trick: a new payment should remember the
6291 # previous failure, and go directly for the successful route
6292 # through fw2
6293
6294 inv = recipient.rpc.invoice(
6295 4200000,
6296 "lbl2",
6297 "desc2",
6298 exposeprivatechannels=[], # suppress routehints, so fees alone control route
6299 )['bolt11']
6300
6301 # We should not have touched fw1, and should succeed after a single call
6302 p = sender.rpc.pay(inv)
6303 assert(p['parts'] == 1)
6304
6305
6306def test_injectpaymentonion_simple(node_factory, executor):

Callers

nothing calls this directly

Calls 3

diamond_networkFunction · 0.85
invoiceMethod · 0.45
payMethod · 0.45

Tested by

no test coverage detected