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

Function test_fee_allocation

tests/test_renepay.py:429–462  ·  view source on GitHub ↗

Topology: 1----2 | | 3----4 This a payment that fails if fee is not allocated as part of the flow constraints. The payment should be straightforward, no failures are expected.

(node_factory)

Source from the content-addressed store, hash-verified

427
428
429def test_fee_allocation(node_factory):
430 """
431 Topology:
432 1----2
433 | |
434 3----4
435 This a payment that fails if fee is not allocated as part of the flow
436 constraints. The payment should be straightforward, no failures are
437 expected.
438 """
439 # We set high fees at 3% and load a plugin that breaks if a sendpay_failure
440 # notification is received.
441 opts = [
442 {
443 "disable-mpp": None,
444 "fee-base": 1000,
445 "fee-per-satoshi": 30000,
446 "plugin": os.path.join(os.getcwd(), "tests/plugins/no_fail.py"),
447 'allow-deprecated-apis': True,
448 },
449 ]
450 l1, l2, l3, l4 = node_factory.get_nodes(4, opts=opts * 4)
451 start_channels(
452 [(l1, l2, 1000000), (l2, l4, 2000000), (l1, l3, 1000000), (l3, l4, 2000000)]
453 )
454
455 inv = l4.rpc.invoice("1500000sat", "inv", "description")
456 l1.rpc.call("renepay", {"invstring": inv["bolt11"], "maxfee": "75000sat"})
457 l1.wait_for_htlcs()
458 invoice = only_one(l4.rpc.listinvoices("inv")["invoices"])
459 assert invoice["amount_received_msat"] >= Millisatoshi("1500000sat")
460
461 # is the no_fail.py plugin still running?
462 l1.rpc.call("nofail")
463
464
465def test_htlc_max(node_factory):

Callers

nothing calls this directly

Calls 9

only_oneFunction · 0.90
MillisatoshiClass · 0.90
start_channelsFunction · 0.85
joinMethod · 0.80
get_nodesMethod · 0.80
wait_for_htlcsMethod · 0.80
invoiceMethod · 0.45
callMethod · 0.45
listinvoicesMethod · 0.45

Tested by

no test coverage detected