Check that fees are correctly computed.
(node_factory)
| 604 | |
| 605 | |
| 606 | def test_fees(node_factory): |
| 607 | """ |
| 608 | Check that fees are correctly computed. |
| 609 | """ |
| 610 | # made up some random fees for every node |
| 611 | opts = [ |
| 612 | {"disable-mpp": None, "fee-base": 1000, "fee-per-satoshi": 100, 'allow-deprecated-apis': True}, |
| 613 | {"disable-mpp": None, "fee-base": 2222, "fee-per-satoshi": 203, 'allow-deprecated-apis': True}, |
| 614 | {"disable-mpp": None, "fee-base": 3333, "fee-per-satoshi": 300, 'allow-deprecated-apis': True}, |
| 615 | {"disable-mpp": None, "fee-base": 2012, "fee-per-satoshi": 200, 'allow-deprecated-apis': True}, |
| 616 | {"disable-mpp": None, "fee-base": 1010, "fee-per-satoshi": 100, 'allow-deprecated-apis': True}, |
| 617 | {"disable-mpp": None, "fee-base": 1050, "fee-per-satoshi": 100, 'allow-deprecated-apis': True}, |
| 618 | ] |
| 619 | nodes = node_factory.line_graph(len(opts), wait_for_announce=True, opts=opts) |
| 620 | source = nodes[0] |
| 621 | dest = nodes[-1] |
| 622 | |
| 623 | # check that once gossip is in sync, fees are paid correctly |
| 624 | invstr = dest.rpc.invoice("100000sat", "inv1", "description")["bolt11"] |
| 625 | source.rpc.call("renepay", {"invstring": invstr}) |
| 626 | invoice = only_one(dest.rpc.listinvoices("inv1")["invoices"]) |
| 627 | assert invoice["amount_received_msat"] == Millisatoshi("100000sat") |
| 628 | |
| 629 | # if we update fee policy but gossip is not updated ... |
| 630 | nodes[2].rpc.dev_suppress_gossip() |
| 631 | nodes[2].rpc.setchannel(nodes[3].info["id"], 4000, 300, enforcedelay=0) |
| 632 | |
| 633 | nodes[3].rpc.dev_suppress_gossip() |
| 634 | nodes[3].rpc.setchannel(nodes[4].info["id"], 3000, 350, enforcedelay=0) |
| 635 | |
| 636 | invstr = dest.rpc.invoice("150000sat", "inv2", "description")["bolt11"] |
| 637 | source.rpc.call("renepay", {"invstring": invstr}) |
| 638 | invoice = only_one(dest.rpc.listinvoices("inv2")["invoices"]) |
| 639 | assert invoice["amount_received_msat"] == Millisatoshi("150000sat") |
| 640 | |
| 641 | |
| 642 | def test_local_htlcmax0(node_factory): |
nothing calls this directly
no test coverage detected