I am attempting to compute the routing charges for a lightning community cost of 100,000 msats. The route makes use of the next sequence of channels (CHAN1 is just not proven for privateness causes):
CHAN1 (base payment: 1000, ppm: 9)
647868x2102x1 (base payment: 0, ppm: 5000)
751905x3128x0 (base payment: 0, ppm: 5000)
751905x3125x0 (base payment: 1000, ppm: 1)
The route that lightning-cli returns is the next:
"route": [
{
"id": "0298f6074a454a1f5345cb2a7c6f9fce206cd0bf675d177cdbf0ca7508dd28852f",
"channel": "CHAN1",
"direction": 1,
"msatoshi": 101505,
"amount_msat": "101505msat",
"delay": 123,
"style": "tlv"
},
{
"id": "023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b2867b77f",
"channel": "647868x2102x1",
"direction": 1,
"msatoshi": 101505,
"amount_msat": "101505msat",
"delay": 89,
"style": "tlv"
},
{
"id": "0265c45476ef53365755f7076eef987965f308b04dba1d8f74638e75b3164eafdd",
"channel": "751905x3128x0",
"direction": 0,
"msatoshi": 101000,
"amount_msat": "101000msat",
"delay": 49,
"style": "tlv"
},
{
"id": "026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2",
"channel": "751905x3125x0",
"direction": 1,
"msatoshi": 100000,
"amount_msat": "100000msat",
"delay": 9,
"style": "tlv"
}
]
The second to final channel is routing 101,000 msat, which signifies that the second to final node (0265c4…) receives 1,000 msats as a routing payment. I do not perceive how this quantity is calculated.
I assumed the proper payment is:
math.ceil(base + 100,000 * ppm) = math.ceil(1,000 + 100,000 * (1/1,000,000)) = math.ceil(1,000.1) = 1,001 msats.
What’s the right formulation?